Java Midi Tools

Java actually has support for midi in its javax.sound.midi package. Unfortunately, the package only decodes the midi into binary midi messages. I have written code to extend the usability of this package:
I have created four packages:

edu.columbia.ee.csmit.MidiKaraoke.examples

Contains several examples of how to use the code including PianoRollExample, which shows you how to get a piano roll - conceptually a list of notes - out of a midi file.

edu.columbia.ee.csmit.MidiKaraoke.MidiMessage

Contains binary message parsers, such as NoteOffParser, and message objects, such as NoteOff.

edu.columbia.ee.csmit.MidiKaraoke.read

Contains the higher-level code for reading midi files such as RawMidiMessageParser, which can parse individual binary midi messages into MidiCommand objects.

edu.columbia.ee.csmit.MidiKaraoke.write

Contains the higher-level code for writing midi files such as SimpleMidiWriter, which can create simple midi files with a single tempo.


* Updated 2012-04-03 to fix a small bug that affected notes that have the same pitch and start time on separate tracks. Updated 2010-07-12 to include source code. Use jar -xvf KaraokeMidiJava.jar to extract the code from the archive.
** Updated 2010-07-12 so that the javadoc for the example classes contains the relevant code.