Ref / Hz.Plugins / FluidSynth

Hz.Samplo, Hz.Syntho, FluidSynth, Hz.Osc
Hz.Filt, Hz.Echo, Hz.Delay, Hz.Reverb
Hz.Mix, Hz.LFO, Hz.ADSR
see also Hz.Builtins, Plugin Explorer, Hz.Plugins Examples


Intro

FluidSynth.clap is a simple, open source bridge to the FluidSynth soundfont synthesizer in the form of a CLAP plugin. For your convenience, Hz includes FluidSynth along with its Hz.Plugins suite. Source-code and builds for FluidSynth.clap can also be found on github.

Presets, Soundfonts

To make any sound using FluidSynth you must provide it with a soundfont file. A default soundfont is part of the Hz distribution but additional soundfont files can easily be found on the internet. The go-to starter soundfont is FluidR3_GM.sf2 and it is the one we include as default.sf2. FluidSynth.clap looks for a default soundfont according to these platform-specific conventions:

platform type location
Windows system C:/Program Files/Common Files/Sounds/Banks/default.sf2
Windows user $LOCALAPPDATA/Sounds/Banks/default.sf2
MacOS system /Library/Audio/Sounds/Banks/default.sf2
MacOS user $HOME/Library/Audio/Sounds/Banks/default.sf2
Linux system /usr/share/sounds/sf2/default.sf2
Linux custom /usr/local/share/sounds/sf2/default.sf2
Linux user $HOME/Documents/sounds/sf2/default.sf2

To override these defaults, we employ CLAP's preset extension to allow you to request an alternate soundfont file. In other words, .sf2 files are the preset files compatible with this plugin. To load a soundfont you should be able to request a preset load via your favorite CLAP host application.

In Hz this looks like this:

let fluidSynth = scene.NewAnode("FluidSynth", {preset:pathToSf2});

Here are a few sources for free soundfonts:

State Save/Restore

We support the clap.state extension but since the state includes the filepath to the active soundfont, state files may not be perfectly portable.

WebGUI

The version of FluidSynth.clap that is included with Hz implements a simple interface using its webview gui subsystem.

Here's a look:

Parameters

In typical usage, FluidSynth exposes a large collection of "canned" instrument sounds that are selected by the instrument index. Thus, very little user-interface is required. Just select instrument/bank indices in your sound font. Most CLAP hosts offer a stripped-down parameter editing interface which may suffice to select different gain and program settings.

The General Midi standard defines a standard mapping between an index and an instrument. Soundfonts with GM in their name purport to follow this convention.

Here are the exposed/supported fluidsynth parameters and their ids.

id range description value range default
0 gain 0-10 0.2
1 reverb 0,1 1
2 roomsize 0-1.2 0.2
3 damping 0-1 0.0
4 width 0-100 .5
5 reverblevel 0-1 0.9
6 chorus 0,1 1
7 chorusNR 0-99 3
8 choruslevel 0-10 2
9 chorusspeed 0-1 .3
10 chorusdepth 0-256 8
11 chorusmod 0,1 1
32-47 program associated with midi chans 0-15 0-127 0
48-63 bank associated with midi chans 0-15 0-127 0

More details on these settings can be found in the fluidsynth docs.

See Also

FluidSynth Example

home .. topics .. interface .. reference .. examples .. tipjar