musicxml2mid - Perl script to convert MusicXML to MIDI


 musicxml2mid Example.xml > Example.mid
 musicxml2mid Example.xml | aplaymidi -
 musicxml2mid -v      # prints version number


This script converts a musical score in MusicXML format into a MIDI file. It uses the XML::Parser module to read the xml input, and the MIDI-Perl module to put together the midi output.

It was written to assist in debugging "muscript -xml".

It handles both partwise and timewise scores, and seems to work correctly on all the sample MusicXML files at, and on all output from "muscript -xml".

There is (was ?) a Python script called musicxml2midi on Sourceforge, so this script has no final "i", to reduce the amount of confusion...


Generates Debugging output.
Prints Version number.


The current version of musicxml2mid is available by http at (save it to disc, make it executable, and move it into your $PATH),
or as part of (unpack the tar archive somewhere in your $PATH).
If necessary, edit the first lines to reflect where perl is installed on your system.

You'll also need to install the MIDI-Perl module and the XML::Parser module.


1.8, 20200829, workaround to suppress wide characters
1.7, 20090205, add lyric events, as suggested by Albert Frantz
1.6, 20070301, fix bug with a timesig after the start
1.5, 20070301, fix bug in rests
1.4, 20070228, Char handler copes with multiple calls in a single string
1.3, 20070227, correct MIDI Type (format=1) if multiple parts (thanks to Pete in
1.2, 20070225, handles timewise musicxml, different <divisions> in each <part>, grace notes, and short bars
1.1, 20070222, handles channels in recordare and muscript files


Peter J Billam


Based on Larry Wall's XML::Parser module and Sean Burke's MIDI::Perl module.