Class MidiIn

Wrapper for webmidi.js input. Listens on multiple channels.

Constructors

  • Construct a new wrapper for a webmidi.js input device.

    Parameters

    • callback: NoteOnCallback

      Function to call when a note-on event is received on any of the available channels.

    • channels: Set<number>

      Channels to listen on.

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

      Logging function.

        • (msg): void
        • Parameters

          • msg: string

          Returns void

    Returns MidiIn

Properties

_noteOff: ((event) => void)

Type declaration

    • (event): void
    • Parameters

      • event: NoteMessageEvent

      Returns void

_noteOn: ((event) => void)

Type declaration

    • (event): void
    • Parameters

      • event: NoteMessageEvent

      Returns void

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

Type declaration

    • (msg): void
    • Parameters

      • msg: string

      Returns void

noteOffMap: Map<number, ((rawRelease) => void)>

Note-off map from (noteNumber + (midiChannel - 1) * 128) to callbacks.

Type declaration

    • (rawRelease): void
    • Parameters

      • rawRelease: number

      Returns void

Methods

  • Fire global note-off.

    Returns void

  • Make this wrapper (and your callback) respond to note-on/off events from this MIDI input.

    Parameters

    • input: Input

      MIDI input to listen to.

    Returns void

  • Parameters

    • event: NoteMessageEvent

    Returns void

  • Parameters

    • event: NoteMessageEvent

    Returns void

  • Make this wrapper (and your callback) stop responding to note-on/off events from this MIDI input.

    Parameters

    • input: Input

      MIDI input that was listened to.

    Returns void