Home

Awesome

midievents

Decode/encode MIDI events.

NPM version Build status Dependency Status devDependency Status Coverage Status Code Climate Dependency Status

What it does

What it doesn't do

Usage

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

// Parse MIDI events
var events = [];
var parser = new MIDIEvents.createParser(new DataView(anyBuffer), 0, false);
var event = parser.next();

do {
  events.push(event);
  event = parser.next();
} while(event);

// Check bufffer size before encoding
if(anyBuffer.length >= MIDIEvents.getRequiredBufferLength(events)) {
  console.log('ok');
}

// 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

## Contributing

License

MIT