Robot Butler
  Making those complicated tasks nice and easy.
  A hub for guides, walkthroughs and general information.
Follow us on Twitter RSS Feed
Article ImagePlaying 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.

The Player


Timidity++ 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.

The Problem


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:
timidity mymidi.mid
... 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 (SGM) Mirror. 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 or similar.

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:
/etc/timidity++/timidity.cfg
Comment out all lines in the configuration file by placing a # at the start of each line. Now add the line:
soundfont /usr/share/soundfonts/SGM-V2.01.sf2
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.

Comments

Auto-Avatar
Maurice   ~   Posted on 2012-07-25 18:31:16
Yay, thanks! I can finally listen to my small midi collection again without hurting my ears.
Auto-Avatar
poolos   ~   Posted on 2014-04-05 03:41:53
Don't forget to decompress the soundfont with sfArk App(http://melodymachine.com/sfark.htm), the final sf2 file to use is around 236M (SGM-V2.01.sf2). Works great !!

Post a Comment

    Name
    Email (not displayed)

The name of this website is Robot...      


Info STATISTICS

  • 14 categories
  • 50 articles
  • 137 comments

Site, design and code by Benjamin Hodgetts.