Getting MIDI Playback working on a modern Linux box with Firefox and Opera.

This information is current to the year 2011.

I was surprised that nowadays web browsers don't necessarily support embedded MIDI as a default!  I tested under WinXP on a virtual machine and found that M$ Internet Exploder 6 actually plays the MIDI via windows media player controls, but Firefox wants to install QuickTime!  Yuck!!  I remember using Netscape 3 and 4 as well as whatever version of Internet Exploder was in Win95/98 and they all used to work no problem.  Anyway, I digress..

Install mozplugger and timidity packages.  I don't know what package provides "mozplugger" on systems other than Debian, but in any case you'll need the library "/usr/lib/mozilla/plugins/"

Remove timidity from your init scripts (or upstart) so it doesn't run as a daemon.

Edit /etc/mozpluggerrc so it only has this in it:

 audio/mid:midi,mid:MIDI audio file
 audio/x-mid:midi,mid:MIDI audio file
 audio/midi:midi,mid:MIDI audio file
 audio/x-midi:midi,mid:MIDI audio file
 controls noisy stream: timidity "$file"

Note:  I use Pulseaudio so you might need to change the line above to something like "timdity -Os" if you are only using Alsa.  Check the man page for more info.

Check the plugins page in Firefox to make sure mozplugger acting as the plugin for MIDI files.

This works in Opera as well as long as you choose mozplugger as the playback plugin for all the MIDI file types in the Downloads options section.

Note 2:  Notice that I didn't tell you how to setup Timidity?  There's some work to make it sound good.  You need to find a good set of soundfonts, assuming you're not using a real MIDI soundboard.  There's info out there, just search.

Here is a really really good soundfont.

Here are two good soundfonts, but not as good as the above.