Creating the synthesizer
Prev |  | Next

## Creating the synthesizer

To create the synthesizer, you pass it the settings object, as in the following example:

    #include <fluidsynth.h>

    int main(int argc, char** argv)
    {
      fluid_settings_t* settings;
      fluid_synth_t* synth;

      fluid_settings_t* settings = new_fluid_settings();

      synth = new_fluid_synth(settings);

      /* Do useful things here */

      delete_fluid_synth(synth);
      delete_fluid_settings(settings);
      return 0;
    }

The default settings should be fine for most uses. A detailed description of all the settings used by the synthesizer described below.

Table 1. Synthesizer settings

synth.gain | Type | number
| Default | 0.2
| Min-Max | 0.0-10.0
| Description | The gain is applied to the final or master output of the synthesizer. It is set to a low value by default to avoid the saturation of the output when random MIDI files are played.
synth.sample-rate | Type | number
| Default | 44100
| Min-Max | 22050-96000
| Description | The sample rate of the audio generated by the synthesizer.
synth.polyphony | Type | integer
| Default | 256
| Min-Max | 16-4096

Description

The polyphony defines how many voices can be played in parallel. The number of voices is not necessarily equivalent to the number of notes played simultaniously. Indeed, when a note is struck on a specific MIDI channel, the preset on that channel may created several voices, for example, one for the left audio channel and one for the right audio channels. The number of voices activated depends on the number of instrument zones that fall in the correspond to the velocity and key of the played note.

synth.midi-channels | Type | integer
| Default | 16
| Min-Max | 16-256
| Description | This setting defines the number of MIDI channels of the synthesizer. The MIDI standard defines 16 channels, so most hardware keyboards are limited to 16. If you plan to use the synthesizer as a plugin in an application, it might be interesting to set the number of channels to a larger value. In this case you can program a greater number of presets.
synth.reverb.active | Type | string
| Default | "yes"
| Description | When set to "yes" the reverb effects module is activated. Otherwise, no reverb will be added to the output signal. Note that when the reverb module is active, the amount of signal send to the reverb module depends on the "reverb send" generator defined in the SoundFont.
synth.chorus.active | Type | string
| Default | "yes"
| Description | When set to "yes" the chorus effects module is activated. Otherwise, no chorus will be added to the output signal. Note that when the reverb module is active, the amount of signal send to the chorus module depends on the "chorus send" generator defined in the SoundFont.
synth.ladspa.active | Type | string
| Default | "no"
| Description | When set to "yes" the LADSPA subsystem will be called. This subsystem allows to load and interconnect LADSPA plugins. The output of the synthesizer is processed by the LADSPA subsystem. Note that the synthesizer has to be compiled with LADSPA support. More information about the LADSPA subsystem later.
synth.audio-groups | Type | integer
| Default | 1
| Min-Max | 1-128
| Description | By default, the synthesizer outputs a single stereo signal. Using this option, the synthesizer can output multichannel audio.
synth.effects-channels | Type | integer
| Default | 2
| Min-Max | 2-2
| Description |
synth.verbose | Type | string
| Default | "no"
| Description | When set to "yes" the synthesizer will print out information about the received MIDI events to the stdout. This can be helpful for debugging. This setting can not be changed after the synthesizer has started.
synth.dump | Type | string
| Default | "no"
| Description |

Prev |  | Next
Creating and changing the settings | Home | Creating the audio driver