Class MidiOut

Wrapper for a webmidi.js output. Uses multiple channels to achieve polyphonic microtuning.

Constructors

  • Constuct a new wrapper for a webmidi.js output.

    Parameters

    • output: null | Output

      Output device or null if you need a dummy out.

    • channels: Set<number>

      Channels to use for sending pitch bent MIDI notes. Number of channels determines maximum microtonal polyphony.

    • Optional log: ((msg) => void)

      Logging function.

        • (msg): void
        • Parameters

          • msg: string

          Returns void

    Returns MidiOut

Properties

channels: Set<number>
lastEventTime: number
log: ((msg) => void)

Type declaration

    • (msg): void
    • Parameters

      • msg: string

      Returns void

output: null | Output
voices: Voice[]

Methods

  • Schedule a series of notes to be played at a later time. Please note that this reserves the channels until all notes have finished playing.

    Parameters

    • notes: Note[]

      Notes to be played.

    Returns void

  • Select a voice that's using a cents offset compatible channel or the oldest voice if nothing can be re-used.

    Parameters

    • centsOffset: number

      Cents offset (pitch-bend) from 12edo.

    Returns Voice

    A voice for the next note-on event.

  • Send a note-on event and pitch-bend to the output device on one of the available channels.

    Parameters

    • frequency: number

      Frequency of the note in Hertz (Hz).

    • Optional rawAttack: number

      Attack velocity of the note from 0 to 127.

    • Optional time: number

    Returns ((rawRelease?, time?) => void)

    A callback for sending a corresponding note off on the correct channel.

      • (rawRelease?, time?): void
      • Parameters

        • Optional rawRelease: number
        • Optional time: number

        Returns void

  • Returns void