GStreamer, MIDI (and Ubuntu)

So, you have all your old MIDI files lying around and you decide to play them through Totem or another GStreamer based player. What happens? They sound... flat.

Ah, no problem you think, I'll just set up Timidity to use the neat soundfont I have lying around that sounds like my old SoundBlaster card and everything will be peachy, but no, GStreamer doesn't support soundfonts cause it doesn't use timidity but wildmidi - what to do?

Or: How to convert soundfonts to GUS patches for use in wildmidi/gstreamer.

There's a neat little tool called Unsf included in Greg Lee's gt - a stripped down version of Timidity - that can convert a soundfont to a GUS patch usable by wildmidi and therefore GStreamer, so let's get started with the conversion!

First, go to where you want the GUS patch (and its files) - this path shouldn't contain spaces - then download the latest version of gt (I hear there's a version 1.0, but 0.4 is the latest I can find):

1cd /where/you/want/the/GUS/files
2wget ftp://ling.lll.hawaii.edu/pub/greg/gt-0.4.tar.gz

Now, let's extract it somewhere and build it:

1tar -xzf gt-0.4.tar.gz
2cd gt-0.4
3./configure
4cd utils
5make

Now, let's convert the soundfont to a GUS patch (remember to replace /path/to/your/soundfont.sf2 with the actual path to your soundfont):

1cd ../../GUS
2../utils/unsf -F /path/to/your/soundfont.sf2

Now we need to fix the config file that unsf wrote to include the path to where your GUS patch is:

1echo -e "dir $PWDn" & wildmidi; cat *.cfg >> wildmidi

Now let's "install" that config file:

1sudo cp wildmidi /etc/wildmidi.cfg

There! You're done!

For a nice athentic old school midi sound, I recommend the following soundfont (you need to register to download though): http://www.sf2midi.com/soundfonts/file-detail/roland-sc-55-sf2-3033.html