Table of Contents

Portable software MIDI output with SF2 soundfonts using the open source FluidSynth.

The FluidSynth audio plugin implements a Doomsday Music interface that synthesizes MIDI music into a raw PCM samples using libfluidsynth. However, because the PCM data's length is not known beforehand, it needs to be played in streaming mode.

How to use {{veradd|1.9.9}}

Enabling audio_fluidsynth

To verify that the plugin is in use, look for the “Audio configuration” printed in doomsday.out. It should contain a mention of FluidSynth being used as a Music interface. The command-line option

  1. imusic fluidsynth

forces the engine to use FluidSynth for music playback.

Loading an SF2 soundfont

You must set the cvar music-soundfont to the full path of an SF2 soundfont file. The first time you set the cvar, it takes until the start of the next song for the SF2 to be taken into use, i.e., it won't happen immediately.

Changing/unloading the SF2 soundfont

If a MUS/MIDI song is already playing with an SF2 soundfont, changing the value of music-soundfont will immediately have an effect and the MIDI music continues to play using the new soundfont.

If a MUS/MIDI song is playing with an SF2 soundfont and you clear music-soundfont or change it to a .DLS file, the current music will stop and when the next song starts, it will play through another music interface (if available; e.g., FMOD with .DLS).

Technical notes

The FluidSynth plugin supports Mac OS X and Linux, but not Windows (needs GLib 2 library).

A streaming sample is similar to standard samples (sfxsample_t) with the exception that instead of having a direct pointer to the sample data, it has a callback function through which the sample data is returned on demand. The existing audio drivers need to be modified to support streaming samples.

For distribution packaging, GLib and its dependencies must be included as shared libraries/dependencies.

Build configuration

The plugin can be compiled in one of two ways:

libfluidsynth mode

Embedded mode

Notes

<references/>

See also

1)
This is mostly due to minimizing duplicate functionality: the existing audio plugins are fully capable of handling PCM output. It would be possible for audio_fluidsynth to output the audio on its own, but that would mean additional external dependencies and platform-specific compilation setup.