Decode/encode MIDI events.

npm install midievents
1 downloads in the last day
2 downloads in the last week
8 downloads in the last month

MIDIEvents Build Status

MIDIEvents is a helper intended to help working with MIDI events. MIDIEvents is the base project for MIDIFile and MIDIPlayer.

MIDIEvents can be used either in modern browsers (pick the last bundle) or with NodeJS by installing the following NPM module :

npm install midievents

What it does

  • Decode midi events
  • Check midi events (using strictMode)
  • Calculate needed buffer to encode midi events
  • Encode midi events

What it doesn't do


// Your variable with an ArrayBuffer instance containing your MIDI events
var anyBuffer;

// MIDI events parser
var event, events=[], parser;
parser=new MIDIEvents.createParser(
  new DataView(anyBuffer),
    0, false);
do {
} while(event);

// Check bufffer size before encodng
if(anyBuffer.length >= MIDIEvents.getRequiredBufferLength(events)) {

// Encode MIDI events
var destination = new Uint8Array(anyBuffer);
MIDIEvents.writeToTrack(events, destination);

Contributing / Testing

Install them and run the following command :

npm install --dev
su npm install grunt-cli -g
grunt test


  • Feel free to PR
  • If you find MIDI events the library can't read, create a test an do a pull request. I'll work on it asap.


Copyright Nicolas Froidure 2013. MIT licence.

npm loves you