midi2wavs - Converts each midi-channel into a separate .wav file
midi2wavs foo.mid # generates foo_cha0.wav, foo_cha1.wav etc midi2wavs -n foo.mid # No-op; doesn't generate the wav files midi2wavs -q foo.mid # Quiet; doesn't suggest mixdown commands midi2wavs -v # prints the Version
This script converts each midi-channel in the foo.mid into a separate foo_chaX.wav file, then suggests suitable midifade and ecasound commands for a mixdown. For example:
suggested commands for a simple mixdown: midifade -o 0 c1m7v80 c2m7v80 c3m7v80 c4m7v80 c5m7v80 c6m7v80 ecasound -Md:alsaseq,midifade:0 \ -a:1 -i:/tmp/t_cha1.wav -ea:63 -km:1,0,100,7,2 \ -a:2 -i:/tmp/t_cha2.wav -ea:63 -km:1,0,100,7,3 \ -a:3 -i:/tmp/t_cha3.wav -ea:63 -km:1,0,100,7,4 \ -a:4 -i:/tmp/t_cha4.wav -ea:63 -km:1,0,100,7,5 \ -a:5 -i:/tmp/t_cha5.wav -ea:63 -km:1,0,100,7,6 \ -a:6 -i:/tmp/t_cha6.wav -ea:63 -km:1,0,100,7,7 \ -a:1,2,3,4,5,6 -o:loop,1 -a:20,21 -i loop,1 \ -f:16,2,44100 -a:20 -o:/tmp/t_mix.wav -a:21 -o:alsa
It uses by default the Lua module fluidsynth.lua to perform the conversion into wav. You'll want to edit ~/.fluidsynth to configure your favourite soundfonts; see the documentation for read_config_file()
If fluidsynth.lua is not available then it uses the timidity executable, working around a quirk in timidity (fixed in version 2.14) which deletes initial silence while converting to wav.
If those are not available then it uses the fluidsynth executable, working around a quirk which truncates release and reverb on the final note.
It uses the luaposix Lua module to access the file-system, and the MIDI.lua Lua module to handle the MIDI format.
No-op ; doesn't generate the wav files
Quiet ; doesn't output the suggested commands for a mixdown
Print the Version
20140907 1.2 uses normalize-audio (if present) on the output files 20140824 1.1 uses fluidsynth.lua with 'fast.render' 20140805 1.0 first working version
The latest version is available at http://www.pjb.com.au/midi/free/midi2wavs
Just move it into your $PATH, make it executable, and if necessary change the first line to reflect where lua is installed on your system.
You will also need to install MIDI.lua, fluidsynth.lua and luaposix, for example:
luarocks install MIDI luarocks install fluidsynth luarocks install luaposix
Peter J Billam, http://www.pjb.com.au/comp/contact.html
http://www.pjb.com.au/ http://www.pjb.com.au/midi/midi2wavs.html http://www.pjb.com.au/comp/lua/MIDI.html http://www.pjb.com.au/comp/lua/fluidsynth.html http://www.pjb.com.au/midi/midifade.html http://eca.cx/ecasound/ http://www.fluidsynth.org/ http://timidity.sourceforge.net/ https://lists.sourceforge.net/lists/listinfo/timidity-talk man normalize-audio