MIDI with VLC media player

Every so often, someone asks if VLC could support MIDI, the de-facto industry standard for digital music instruments.

Input

As a matter of facts, VLC already supports MIDI - to some extent. The Standard MIDI Files (*.MID) parser plugin was published in October 2007. In April 2008, RIFF files (*.RMI) support was added. That plugin was in VLC releases since version 0.9.0. At the time of writing (July 2009), VLC does however not support hardware MIDI inputs neither networked MIDI over RTP.

Also, support for other file formats is missing, including:

As a matter of facts, I am looking for legal and good documentation on the XMI format (not XMF!), so that support could be added as well.

Synthesis

But then, VLC still needs to synthesize sounds from the MIDI events. Unfortunately, hardware synthesis with the audio adapter would be rather tricky. Indeed, the VLC audio mixing and output core subsystem was designed for PCM samples (with special support for S/PDIF). Also, while FM synthesis was common in the good old days (notably DOS games), most modern (cheap) audio adapters, such as AC'97 audio controllers or Intel HDA cards, lack hardware synthesizer anyway.

So VLC resorts to software synthesis with a sound font file (*.SF2) through the Fluidsynth open-source library. Timidity is more commonly used, but it is not available as a C programming library out of the box.

That raises two potential problems:

If not included in your version, you may need to complain to your packager, and build VLC from source yourself. You can easily find free sound fonts websites from Google; then tell VLC where to find it from the preferences dialog (Codecs / Fluidsynth).

VLC FluidSynth plugin configuration

Now you can play MIDI files!