MIDI events parser/encoder.
JavaScript
Latest commit e142c6d Jan 9, 2016 @nfroidure Small fixes
Failed to load latest commit information.
dist
src
tests
.editorconfig Modernizing used tools and adding linter config Jan 9, 2016
.eslintrc
.gitignore Added coverage tests Feb 11, 2014
.travis.yml
LICENCE
README.md
package.json Small fixes Jan 9, 2016

README.md

MIDIEvents

MIDIEvents is a module intended to help working with MIDI events.

MIDIEvents is the base project for MIDIFile and MIDIPlayer. You can also check this Karaoke Player built on top of those libraries.

NPM version Build status Dependency Status devDependency Status Coverage Status

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

npm install midievents --save

Browser support

Build Status

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

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

  • 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.
  • Run npm run to get a list of useful development commands.

 License

Copyright Nicolas Froidure. MIT licence.