The two main functions, readmidi_java and writemidi_java are essentially replacements for the readmidi and writemidi functions from the Midi Toolbox (https://www.jyu.fi/hum/laitokset/musiikki/en/research/coe/materials/miditoolbox/ ). readmidi_java allows you to get a piano-roll representation of the midi file as a series of notes. writemidi_java allows you to write out a piano roll.
So why not just use the original Midi Toolbox files? My versions (1) correctly interpret tempo changes when reading in midi files, (2) work on the most recent versions of Windows - as well as other OSs, and (3) provide simple extensions for specifying tracks and instrumentation.
To get my code up and running, you will need to download the code here and a .jar file ( http://www.ee.columbia.edu/~csmit/midi/java/KaraokeMidiJava.jar ). You will then need to add the path to this jar in classpath.txt (type 'edit classpath.txt' in Matlab). You will probably need to restart Matlab once you've updated classpath.txt. If you don't have write access to classpath.txt, you will need to save a copy of the file somewhere else and update this copy. When you start Matlab again, be sure to include the path to this copy of classpath.txt in the command line - i.e. 'Matlab /path/to/classpath.txt' in Linux/Unix.
I have included a couple of example scripts that show how to use my code (example_script1 and example_script2). You can also get more information from my website: http://www.ee.columbia.edu/~csmit/matlab_midi.html .
Christine (2022). Midi Tools (https://www.mathworks.com/matlabcentral/fileexchange/27470-midi-tools), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!