Skip to content

SoundFont synthesis

Dale Whinham edited this page Jan 13, 2021 · 2 revisions

SoundFont is a file format that allows sound samples, instrument mappings and synthesizer behaviors to be stored in a self-contained package. Any SoundFont-compliant synthesizer software or hardware can then load the SoundFont and, in theory, produce the same audio output. The SoundFont was made popular by the Creative Labs Sound Blaster AWE32 and later family of sound cards, which used it to provide reconfigurable MIDI synthesis for use with games and for music production purposes.

The flexibility of the SoundFont standard means that several MIDI specifications such as General MIDI, Roland GS, and Yamaha XG can be implemented with the same synthesizer engine, opening up a wide range of possibilities.

mt32-pi uses the FluidSynth engine to provide SoundFont support, and comes with the GeneralUser GS SoundFont so that you have excellent General MIDI and Roland GS compatibility out of the box.

⚠️ Note: To use the SoundFont synthesizer, you must either set it as the default synth in the config file, or switch to it at runtime using a custom SysEx message or button press.

SoundFont scanning

On startup, mt32-pi will scan the soundfonts directory and perform a quick test on each file to search for valid SoundFonts. SoundFonts are then added to a list, and sorted into lexicographical order (i.e. 0-9, A-Z).

The configuration file allows you to change which SoundFont should be loaded when multiple SoundFonts are available.

Switching SoundFonts

Just like with MT-32 ROMs, you can use a custom SysEx message to make mt32-pi swap SoundFonts at runtime.

The configuration file and custom SysEx messages for SoundFont switching use a zero-based index into a sorted list of valid SoundFonts. This means that 0 is the first, 1 is the second, and so on.

When switching, the current SoundFont is unloaded from memory, and the chosen SoundFont is (re)loaded from SD card. This may take some seconds depending on the size of the file, speed of the SD card, and model of Raspberry Pi.

This behavior may be improved in the future - it will be possible to implement a (pre)caching system to keep frequently-used SoundFonts in memory.

If you add a control surface to your Raspberry Pi, SoundFonts can be switched using Button 2.

Clone this wiki locally