MIDI Player

By: kode54

This component decodes General MIDI files (.MID, .MIDI, .RMI, .KAR) and several MIDI based formats. (.MIDS, .MDS, .HMI, .HMP, .MUS, .XMI, .LDS)

It supports several synthesizers, several of which do not require any additional files to play back music. The bundled synthesizers which do not require additional files may sound rather basic, though.

It also supports Ian Luck's wonderful BASSMIDI SoundFont (.sf2) based synthesizer, including bundled support for his .sf2pack format, which is nearly identical to the basic .sf2 format, except the file identifier is "sfpk" instead of "sfbk", and the audio section of the file is a compressed format supported by BASS that also supports seeking, as it decodes the samples as they are referenced by the MIDI files. The compressed format is identified only by its bitstream properties. BASS includes support for MP3 and Ogg Vorbis samples, while plugins are bundled to support FLAC, WavPack, Musepack, and Opus format samples.

FLAC is the suggested format for saving space and fast decoding, while Opus is suggested for "preview" type downloads, as it provides a relatively stable waveform for loops in this format, while compressing quite a bit. However, I cannot recommend using lossy compression of SoundFonts as a final distribution format, as loops could still show errors.

SoundFonts may be loaded in a simple, or even complex setup, using either basic .sflist text files encoded in UTF-8 format, or .sflist.json files, also encoded in UTF-8 format. A description for the SFLIST JSON format, as well as a parser capable of handling both the original and JSON formats, may be found here:

Please note that the VST instrument and Secret Sauce support executables are bundled, and are invoked using named pipes for communication with standard input and output devices on the executable end. The full source code is also published, in case anyone wants to replicate them, or use them for another purpose. They are built with the same compiler as this component, but since they are not themselves components, they require the Microsoft Visual Studio 2015 C++ runtimes. Both 32 and 64 bit versions, to be precise.

Current version: 2.4.11, released on 2021-04-12

Change log:

  • Continuing to make further improvements to invalid file parsing, now the input will no longer crash if it hits a file with no events

Works with foobar2000 v1.4 and newer


View version history
Source code

More components

Browse all
Browse by author: kode54
Tags: decoder, game music, synthesizer

How to install a component?