Home

Awesome

midimessage

npm version

Simple MIDI Message Parser for JavaScript. This parser takes in a MIDIMessageEvent and returns a plain Javascript Object with propties indicating the data in the MIDI message.

Installation

npm install midimessage

Usage

var MIDIMessage = require('midimessage');

midiInput.onmidimessage = function(event){
	var midiMessage = MIDIMessage(event);
	console.log("Parsed", midiMessage);
}

API

MIDIMessage : Function - Takes a MIDIMessageEvent as the only argument and decodes the data in the MIDIMessageEvent. Returns a MIDIMessage Object which has various properties set to values based on the MIDIMessage.

These properties are based off the MIDI Message Standard as defined in the MIDI Spec

These are some of the properties that may be exposed (based on the incoming MIDI message) :

Possible values of messageType property.

[
'noteon', // Note On event.
'noteoff', // Note Off event.
'keypressure', // Polyphonic Key Pressure (Aftertouch).
'controlchange', // Control Change.
'programchange', // Program Change.
'channelpressure', // Channel Pressure (After-touch).
'pitchbendchange', // Pitch Bend Change.
]

Possible values of channelModeMessage property.

[
'allsoundoff', // All Sound Off.
'resetallcontrollers', // Reset All Controllers.
'localcontroloff', // Local Control Off.
'localcontrolon', // Local Control On.
'allnotesoff', // All Notes Off.
'omnimodeoff', // Omni Mode Off.
'omnimodeon', // Omni Mode On.
'monomodeon', // Mono Mode On (Poly Off).
'polymodeon' // Poly Mode On (Mono Off)
]

License

MIT

See License file