libfluidsynth 2.3.5
Loading...
Searching...
No Matches
Synthesizer

Topics

 Audio Rendering
 
 
 Effect - Chorus
 
 
 Effect - IIR Filter
 
 
 Effect - LADSPA
 
 
 Effect - Reverb
 
 
 MIDI Channel Messages
 
 
 MIDI Channel Setup
 
 
 MIDI Tuning
 
 
 SoundFont Management
 
 
 Synthesis Parameters
 
 
 Synthesis Voice Control
 
 

Lifecycle Functions for Synthesizer_linebr@{

fluid_synth_tnew_fluid_synth (fluid_settings_t *settings)
 Create new FluidSynth instance.
 
void delete_fluid_synth (fluid_synth_t *synth)
 Delete a FluidSynth instance.
 

Functions

const char * fluid_synth_error (fluid_synth_t *synth)
 Get a textual representation of the last error.
 
double fluid_synth_get_cpu_load (fluid_synth_t *synth)
 Get the synth CPU load value.
 

Detailed Description

SoundFont synthesizer

You create a new synthesizer with new_fluid_synth() and you destroy it with delete_fluid_synth(). Use the fluid_settings_t structure to specify the synthesizer characteristics.

You have to load a SoundFont in order to hear any sound. For that you use the fluid_synth_sfload() function.

You can use the audio driver functions to open the audio device and create a background audio thread.

The API for sending MIDI events is probably what you expect: fluid_synth_noteon(), fluid_synth_noteoff(), ...

Function Documentation

◆ delete_fluid_synth()

void delete_fluid_synth ( fluid_synth_t * synth)

Delete a FluidSynth instance.

Parameters
synthFluidSynth instance to delete
Note
Other users of a synthesizer instance, such as audio and MIDI drivers, should be deleted prior to freeing the FluidSynth instance.
Examples
example.c, fluidsynth_arpeggio.c, fluidsynth_fx.c, fluidsynth_metronome.c, fluidsynth_register_adriver.c, fluidsynth_sfload_mem.c, and fluidsynth_simple.c.

◆ fluid_synth_error()

const char * fluid_synth_error ( fluid_synth_t * synth)

Get a textual representation of the last error.

Parameters
synthFluidSynth instance
Returns
Pointer to string of last error message. Valid until the same calling thread calls another FluidSynth function which fails. String is internal and should not be modified or freed.
Deprecated
This function is not thread-safe and does not work with multiple synths. It has been deprecated. It may return "" in a future release and will eventually be removed.

◆ fluid_synth_get_cpu_load()

double fluid_synth_get_cpu_load ( fluid_synth_t * synth)

Get the synth CPU load value.

Parameters
synthFluidSynth instance
Returns
Estimated CPU load value in percent (0-100)

◆ new_fluid_synth()

fluid_synth_t * new_fluid_synth ( fluid_settings_t * settings)

Create new FluidSynth instance.

Parameters
settingsConfiguration parameters to use (used directly).
Returns
New FluidSynth instance or NULL on error
Note
The settings parameter is used directly, but the synth does not take ownership of it. Hence, the caller is responsible for freeing it, when no longer needed. Further note that you may modify FluidSettings of the settings instance. However, only those FluidSettings marked as 'realtime' will affect the synth immediately. See the fluidsettings for more details.
Warning
The settings object should only be used by a single synth at a time. I.e. creating multiple synth instances with a single settings object causes undefined behavior. Once the "single synth" has been deleted, you may use the settings object again for another synth.
Examples
example.c, fluidsynth_arpeggio.c, fluidsynth_fx.c, fluidsynth_metronome.c, fluidsynth_register_adriver.c, fluidsynth_sfload_mem.c, and fluidsynth_simple.c.