Class ClipRecorder

The ClipRecorder class subscribes to an IMidiIn and records incoming MIDI data into a clip.

Once the ClipRecorder has finished, a new clip is dispatched from the newClip event.

Hierarchy

  • ClipRecorder

Implements

Constructors

Accessors

  • get beatCount(): number
  • How many beats to stop the clip recording after.

    This also sets the duration of the clip that will be returned at the end of the recording.

    The default value is 4. If this is set to null, then the recorder will only stop when explicitly told, and the returned clip's length will be however long the recorder ended up running for.

    Returns number

  • set beatCount(value: number): void
  • Parameters

    • value: number

    Returns void

  • get beatsPassed(): number
  • How many beats have passed since recording started.

    Returns number

  • get isFinished(): boolean
  • Returns true if the clip recorder has finished recording.

    Returns boolean

  • get metronome(): IMetronome
  • The metronome which the recorder uses for tracking passed beats.

    Returns IMetronome

  • set metronome(value: IMetronome): void
  • Parameters

    Returns void

  • get midiIn(): IMidiIn
  • The MIDI input which data gets recorded from.

    Returns IMidiIn

  • set midiIn(value: IMidiIn): void
  • Parameters

    Returns void

  • get newClip(): ClipRecorderEvent
  • The newClip event dispatches a new clip object once recording has completed.

    This example will create a ClipRecorder that records a 16 beat phrase. Once done, the phrase is automatically played back on loop:

     const clipRecorder = new ClipRecorder(metronome, midiIn);
    clipRecorer.beatCount = 16;
    clipRecorder.newClip.add(evt => {
    const clipPlayer = new ClipPlayer(evt.clip, metronome, midiOut);
    clock.addChild(clipPlayer);
    });
    clock.addChild(clipRecorder);

    Returns ClipRecorderEvent

  • get ref(): string
  • Provides a way of identifying recorders so they can be easily retrieved later.

    Returns string

  • set ref(value: string): void
  • Parameters

    • value: string

    Returns void

  • get typeName(): string
  • Returns the name of this type. This can be used rather than instanceof which is sometimes unreliable.

    Returns string

Methods

  • Calling this tells the clip recorder to stop whatever it's doing and that it will no longer be used.

    Returns void

  • This method is intended to be called by a clock to provide regular updates. It should not be called by consumers of the library.

    Returns

    Parameters

    • deltaMs: number

      How many milliseconds have passed since the last update cycle.

    Returns void

  • Provides a way for setting the ref through a chained function call. For example:

    clock.addChild(new ClipRecorder(metronome, midiIn).withRef('recorder'));
    

    Returns

    The calling object.

    Parameters

    • ref: string

      The ref to set on the object.

    Returns IClockChild

Generated using TypeDoc