LinuxCommandLibrary

fluidsynth

Plays MIDI files using SoundFont synthesizers

TLDR

Play a MIDI file

$ fluidsynth [path/to/soundfont.sf2] [path/to/file.midi]
copy

Specify the audio driver
$ fluidsynth [[-a|--audio-driver]] [pipewire|pulseaudio] [path/to/soundfont.sf2] [path/to/file.midi]
copy

Display help
$ fluidsynth [[-h|--help]]
copy

SYNOPSIS

fluidsynth [OPTIONS] [SOUNDFONT_FILE(s)] [MIDI_FILE(s)]

PARAMETERS

-a, --audio-driver=
    Selects the audio output driver (e.g., alsa, pulseaudio, jack, portaudio, oss).

-m, --midi-driver=
    Selects the MIDI input driver (e.g., alsa_seq, portmidi, jack).

-s, --server
    Starts fluidsynth in server mode, without an interactive shell.

-i, --no-shell
    Prevents the interactive shell from starting when fluidsynth runs.

-o, --option==
    Sets a specific configuration option, such as audio.alsa.period-size=64.

-c, --conf=
    Loads configuration settings from the specified file.

-F, --fifo=
    Uses a named pipe for receiving MIDI events, allowing external programs to send MIDI data.

-g, --gain=
    Sets the global gain (0.0 to 10.0) of the audio output.

-R, --reverb=
    Sets the reverb effect type for the output audio.

-C, --chorus=
    Sets the chorus effect type for the output audio.

-z, --channels=
    Sets the number of audio output channels.

-r, --samplerate=
    Sets the audio sample rate for processing.

-D, --dump
    Dumps information about loaded SoundFonts and then exits.

-h, --help
    Displays a help message and exits.

-v, --version
    Displays version information and exits.

DESCRIPTION

fluidsynth is a real-time software synthesizer that can play MIDI data using SoundFont 2 (SF2) files. It acts as a powerful and flexible sound engine, capable of generating high-quality audio from MIDI input. It's often used as a standalone application, an embedded library, or a sound server for other programs.

Key features include support for various audio drivers (such as ALSA, PulseAudio, JACK, and PortAudio) and MIDI input methods (like ALSA, PortMidi, and JACK). This makes it highly versatile and adaptable to different Linux audio setups. Users can load multiple SoundFonts simultaneously, apply effects like reverb and chorus, and configure various mixing and routing options.

fluidsynth is widely appreciated in the Linux audio community for its low latency capabilities, making it suitable for live performance and interactive music applications. It empowers users to bring MIDI compositions to life with a wide array of instrument sounds provided by SoundFont files.

CAVEATS

Resource Usage: fluidsynth can be CPU and RAM intensive, especially when using large SoundFonts or enabling multiple effects (reverb, chorus). Performance can vary significantly depending on the system hardware and the complexity of the MIDI input.

Latency: While designed for low-latency operation, the actual latency depends heavily on the selected audio driver, its buffer settings, and overall system load. Optimizing these settings is crucial for live performance.

SoundFont Quality: The output sound quality is directly dependent on the quality of the SoundFont 2 (SF2) files used. Low-quality or poorly sampled SoundFonts will result in poor audio output, regardless of fluidsynth's capabilities.

MIDI INPUT AND CONNECTIONS

fluidsynth doesn't automatically detect MIDI input devices. You typically need to connect a MIDI source (e.g., a MIDI keyboard, another software application, or a MIDI file player) to fluidsynth's MIDI input port. On Linux, this is often done using ALSA's aconnect utility (e.g., aconnect 20:0 128:0 to connect a MIDI keyboard to fluidsynth's default ALSA port). If using JACK, connections can be made via `qjackctl` or `jack_connect`.

SOUNDFONT FILES

SoundFont 2 (SF2) files are crucial for fluidsynth as they contain the actual instrument samples and synthesis parameters. These files usually have a .sf2 extension. You can specify one or more SoundFont files on the command line when starting fluidsynth. Many free and commercial SoundFonts are available online, offering a vast library of sounds from realistic instruments to synthetic textures.

INTERACTIVE SHELL

When run without the --no-shell or --server options, fluidsynth starts an interactive shell, allowing users to control parameters, load/unload SoundFonts, play notes, and manage effects in real-time. This provides a powerful environment for experimentation and live performance without restarting the application.

HISTORY

fluidsynth was originally developed by Peter Hanappe and first released in 2000. Its primary goal was to create an open-source, high-quality SoundFont 2 compliant software synthesizer. It quickly became a cornerstone of the Linux audio ecosystem due to its robust performance, low latency, and ability to use freely available SoundFont files to produce a wide range of instrument sounds. Over the years, it has evolved with contributions from a dedicated community, adding support for various audio and MIDI drivers, improving efficiency, and expanding its feature set, solidifying its role as a versatile and essential tool for musicians and developers on Linux.

SEE ALSO

qsynth(1), aconnect(1), aplaymidi(1), jackd(1), timidity(1)

Copied to clipboard