midi2muscript - Lua script to convert midi-files to muscript
midi2muscript t.mid >t muscript t >t.ps ; gv t.ps midi2muscript t.mid | muscript >t.ps ; gv t.ps
Each midi channel gets its own muscript stave.
It uses some ad-hoc heuristics to guess where the barlines should go; it favours placing them where lots of notes begin, especially louder and longer notes. Currently it also favours low notes, which usually works very well but sometimes backfires.
It gives a lot of weight to Metronome Bells (GM Channel 9 note 34) even if they have inaudibly low (but non-zero) volumes; so you can use the Metronome to control barline placement. If an improvisation has been made without a metronome-track, overdubbing an improvisation with a metronome-track is not hard, and can be repeated until satisfactory; or you can edit the midi file eg: with midiedit to add Metronome Bells where you want your barlines.
In future, midi2muscript might also try to place barlines on sudden changes of harmony.
It currently makes no attempt to group 8th and 16th-notes under beams; you have to do this by hand if tidying up the score for being printed out and read by musicians.
midi2muscript was written to work like a 16-track tape recorder, for overdubbing one midi-track over another - except that at every stage you get to tidy up or change the result by working on it in muscript score form.
suggests a desirable Barlength (in seconds; 1.96 seconds in this example) which midi2muscript will use as a guide when choosing plausible barlines.
Prints the Version
20150518 1.5 appropriate vol commands extracted 20150517 1.4 pedal stuff approximately working 20150515 1.3 real note-durations; fixed important bug in midibar2pulse() 20150510 1.2 as released 20120829 1.1 first half-working header 20110426 1.0 first working version
midi2muscript is available at:
Just move it into your PATH, make it executable, and if necessary edit the first line to match where Lua is installed on your system.
You will also need the MIDI module:
luarocks install midi
Peter J Billam, http://www.pjb.com.au/comp/contact.html