MIDI to WAVE
From EpixStudios
How do you convert a MIDI file into a WAVE (.wav) file? This is a common problem, for example when you want to put your composition on an audio CD.
Well the obvious option is to connect the output of your sound card back to it's line-in input. You use a recording application such as Audacity to record and then press play in your MIDI player/sequencer. There are a few draw backs, however:
- You will probably need to cut out the blank space at the start and end of your file (created while you switch between applications).
- Instrument sounds you record are limited to those that can be generated by the sound card's synthesizer (OK if you have an expensive sound card, but the chips in most computers are generally cheap and nasty)
- The signal is being converted from digital to analogue (DAC), travelling along a line cable which will pick up white noise interferrance, then be converted from analogue to digital (ADC) again--In short you lose quality.
There is an application called TiMidity which is a synthesizer in itself (rather than using the one on your sound card). Using a software synthesizer is more work for your computer, but can play much higher quality instruments than most sound cards. As well as playing synthesised sounds out to your speakers, it can also play them straight to a WAVE file, which is what we need.
These instructions are for setting up Timidity on Ubuntu Linux. There are applications based on Timidity for Windows but I know nothing about installing these.
First we install timidity
sudo apt-get install timidity
We want some good quality sound fonts. These are pretty realistic as they are sampled from real instuments - They are big files though and take a long time to download!
sudo apt-get install fluid-soundfont-gm fluid-soundfont-gs
Edit TiMidity's configuration file to use the new sound fonts.
sudo nano -w /etc/timidity/timidity.cfg
source /etc/timidity/fluid3.cfg
Move the sound fonts to Timidity's directory.
sudo cp /usr/share/sounds/sf2/Fluid* /etc/timidity/
Save this config file for the fluid sound fonts and copy it to the timidity config directory.
sudo cp fluid3.cfg /etc/timidity/
You should be all set up now. To create a WAVE file from a MIDI use the following command.
timidity -Ow midifile.mid
Conversion will take a while (the same time the piece of music lasts) and there is not much output shown while the rendering takes place. Just hang on and open the .wav file when it finishes.
You can even convert all the MIDI files in a directory:
timidity -Ow *.mid

