Convert MIDI Music to MP3

January 22, 2009 by Noah
Numerous years ago I was trying to find a way of converting MIDI files into WAV or MP3. I tried googling for "midi to wav" but found nothing useful. After going through 10 or 20 pages of search results I gave up. All there was out there were lame commercial products that were way more expensive than they're worth.

(On that note, I'm working on researching stuff for a long article I wanna write concerning the sad state of Windows software and the philosophy behind it).

This is one of many cases where after getting into Linux and the open source world, I discovered some free/open source software that does things that I've always wanted to do. In this case, I discovered TiMidity, a MIDI to WAV converter.

TiMidity is used in Linux for support for the MIDI audio format. Rather than have actual hardware drivers to deal with MIDI directly (like Windows does), TiMidity just converts it into WAV format on-the-fly and sends it straight off to your audio hardware. This is its default behavior, anyway. Last night I was digging through its manpages and found out how to save the output as a WAV file instead of sending it directly to the speakers.

Thus, I finally was able to convert MIDI audio to WAV. For reference here's how to do it:

$ timidity -Ow -o output.wav input.mid

WAV files are big and bulky though, so that's where LAME comes in handy. Instead of saving the output to a file, we can pipe it into LAME and save it as an MP3 on the other side.

Thus, here's a one-liner for converting any MIDI file to an MP3:

$ timidity -Ow -o - input.mid | lame - output.mp3

There are Windows ports of these programs available too.



There are 3 comments on this page. Add yours.

Avatar image
regiemon posted on March 26, 2011 @ 01:59 UTC

can i install timidity using yum? thank you for sharing this.

Avatar image
Derek posted on May 12, 2012 @ 14:27 UTC

Thank you so much for providing this! I've just converted a polyphonic melody to mp3 with your help!

Free mp4 to avi converter

Avatar image
KFW posted on January 2, 2013 @ 10:30 UTC

There are actually dozens, if hundreds, of free MIDI renderers for Windows, many of them having been around since the nineties when I used to actually use such things. I haven't the foggiest idea why you coudn't find them all. Google "midi render windows" and you don't so much get software as you get electronic music sites with whole catalogs of rendering software, and MIDI rendering is such a simple job that most of them work perfectly well, from coolsoft's VirtualMidi driver to Midnight Express (an OLD renderer rather like Timidity) to full-scale music applications like Reaper (if you really want your MIDIs to sound good).

In addition, the AUTOMATIC conversion of MIDI to audio is bound to sound mediocre unless the MIDI is extensively tweaked to match the synth sounds it's played on, OR unless it is played back on the same sound set it was composed on. (of course, inferior MIDI files won't sound good this way either)

On the other hand, a lot of people seem to believe that MIDI is some intrinsically inferior form of electronic music rather than merely a language for storing and editing control data for synthesisers, effect, and other stage hardware.

Add a Comment

Used for your Gravatar and optional thread subscription. Privacy policy.
You may format your message using GitHub Flavored Markdown syntax.