midi-listener
    TypeScript icon, indicating that this package has built-in type declarations

    0.2.0 • Public • Published

    MIDI LISTENER

    This project is early WIP pre-release code. Open to suggestions or comments, please submit an issue!

    Listen for and interpret MIDI device input.

    Basic usage with your TypeScript project:

    Install midi-listener:

    npm install --save midi-listener
    

    Reference the Web MIDI API declarations:

    /// <reference path="../node_modules/midi-listener/source/web-midi.d.ts"/>
    

    Import into your code and use

    import MidiListener from "midi-listener"
     
    (async () => {
     
      // Create the midi listener.
      const midiListener = new MidiListener({
        access: await navigator.requestMIDIAccess()
      })
     
      // Subscribe to the midi listener's events with callbacks.
      midiListener.subscribe({
        onInputChange: report => console.log("MIDI Input Change:", report.inputNames),
        onMessage:     report => console.log("MIDI Message:", report),
        onNote:        report => console.log(" - Note:", report),
        onPad:         report => console.log(" - Pad:", report),
        onPitchBend:   report => console.log(" - Pitch bend:", report),
        onModWheel:    report => console.log(" - Mod wheel:", report)
      })
    })()

    Keywords

    none

    Install

    npm i midi-listener

    DownloadsWeekly Downloads

    0

    Version

    0.2.0

    License

    ISC

    Last publish

    Collaborators

    • chasemoskal