Playing MIDI files in Linux has always been a bit alien. Back when MIDI was big, no-one really used Linux on the Desktop. Now that Linux is more popular, MIDI has all but disappeared due to there no-longer being a need for tiny audio files when everyone has the space for full blown 7.1 channel studio quality lossless mixes.
But still, now and then you may stumble across an old track you want to hear, or maybe a file from an old DOS game that you'd like to play, well this guide will help you do that, and do it well.
is generally regarded as the best MIDI player on Linux mainly for simplicity reasons. It is a nice basic command line program to play MIDI files and it's often used by larger applications for MIDI support.
There's no need to compile the application from scratch on pretty much any distro as it's almost guaranteed that your distro will have a package for it. Just have a quick look in your distro's package manager for timidity or timidity++ and I'm sure you'll find it.
Once you've installed Timidity++ you can simply play any MIDI file by chdir'ing to the folder the MIDI is in and running it with the Timidity program, like so:
... and it should play.
Unfortunately, it probably sounds awful, or more specifically it probably sounds just like it used to on your old Soundblaster 16, which is, as I said, awful. Don't worry, we can make it sound so much better...
Making MIDI Sound Better
By default Timidity uses generated sounds to emulate a soundfont, a soundfont is a bank of sound effects that MIDI uses to create the music. I've been searching high and low for the best general MIDI waveset/soundfont for another of my websites and this journey has resulted in the downloading of many, many different soundfonts. Some were several gigabytes in size so you would assume they were good, but unfortunately this isn't the case.
Eventually I found what appears to be the best soundfont for general MIDI...
The Best Soundfont
So what is it? Personally I feel it's Shan's General Midi Soundfont
. It works very well with most tracks and the samples are very high quality, no clicking, noise or obvious bad quality anywhere.
So how do you use it? Again most distros seem to have this packaged up so do a search in your distro's repos for 'sgm' and you should find it. If you're using Ubuntu or Debian then may need to use the Debian Multimedia
repo to get it.
Once you've installed the Soundfont (it should end in .sf2, if not, make sure you've extracted it using SFArc first) make a note of where it is. If you've installed it using your distro's package manager then it will probably be in /usr/share/soundfonts
Using the Soundfont
Now you need to tell Timidity++ to use your shiny new soundfont. This is nice and simple, first, open the Timidity++ configuration file, this should be:
Comment out all lines in the configuration file by placing a # at the start of each line. Now add the line:
Make sure that the path and name of the soundfont match where it is on your own system.
And that should be it, next time you play a MIDI file it'll use the SGM soundfont and it should sound much, much better than the default and what it used to sound like on your old 486!
If you'd like to test the difference, simply comment out the soundfont line you just added and try playing a MIDI file again, it should be night and day.