Zerk Zone

Pages for the Creations of Ryan Armstrong

Convert Midi script

Posted on October 4th, 2014 @ 8:41 am by Zerker

This is script I recently cooked up after picking up MT32 and Roland SoundCanvas sound modules to play midi files and record the playback with said hardware synth. I then encoded the recordings and loaded them on my media player.

If you have a hardware synth (or quality software synth should such a thing exist) you should be able to use this.

usage: convertmidi.py [-h] [-d MIDIDEVICE] convertpath

Converts all mid files in a path to WAV. Uses the tools playsmf to play the midi files and sox to record the resulting audio. Both tools must be present on the system path. You should have your OS configured to record from whichever device the midi output will be sent to ahead of time.

positional arguments:
  convertpath    Path to process

optional arguments:
  -h, --help     show this help message and exit
  -d MIDIDEVICE  Midi Device identifier (default of 1 for first external
                 synth)

This script also requires Python 3.x. I’ve only tested this in Windows due to better support for my sound card, but there’s nothing particularly Windows-specific about the script. It should run fine in Linux with appropriate versions of playsmf and sox.

It also comes with a reset.mid file I downloaded from somewhere to reset the midi controller between songs in case anything gets stuck/confused. I’d love to also give credit for this file, but I can’t figure out where I got it anymore.

Download (1.4 kB)

Comments (0)

Filed under: Programs/Libraries,Python |

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment