libfluidsynth  2.0.1
Enumerations | Functions
synth.h File Reference

Embeddable SoundFont synthesizer. More...

Enumerations

enum  fluid_midi_channel_type { CHANNEL_TYPE_MELODIC = 0, CHANNEL_TYPE_DRUM = 1 }
 The midi channel type used by fluid_synth_set_channel_type() More...
 
enum  fluid_chorus_mod { FLUID_CHORUS_MOD_SINE = 0, FLUID_CHORUS_MOD_TRIANGLE = 1 }
 Chorus modulation waveform type. More...
 
enum  fluid_interp {
  FLUID_INTERP_NONE = 0, FLUID_INTERP_LINEAR = 1, FLUID_INTERP_4THORDER = 4, FLUID_INTERP_7THORDER = 7,
  FLUID_INTERP_DEFAULT = FLUID_INTERP_4THORDER, FLUID_INTERP_HIGHEST = FLUID_INTERP_7THORDER
}
 Synthesis interpolation method. More...
 
enum  fluid_synth_add_mod { FLUID_SYNTH_OVERWRITE, FLUID_SYNTH_ADD }
 Enum used with fluid_synth_add_default_mod() to specify how to handle duplicate modulators. More...
 
enum  fluid_iir_filter_type { FLUID_IIR_DISABLED = 0, FLUID_IIR_LOWPASS, FLUID_IIR_HIGHPASS }
 Specifies the type of filter to use for the custom IIR filter. More...
 
enum  fluid_iir_filter_flags { FLUID_IIR_Q_LINEAR = 1 << 0, FLUID_IIR_Q_ZERO_OFF = 1 << 1, FLUID_IIR_NO_GAIN_AMP = 1 << 2 }
 Specifies optional settings to use for the custom IIR filter. More...
 
enum  fluid_channel_mode_flags { FLUID_CHANNEL_POLY_OFF = 0x01, FLUID_CHANNEL_OMNI_OFF = 0x02 }
 Interface to poly/mono mode variables. More...
 
enum  fluid_channel_breath_flags { FLUID_CHANNEL_BREATH_POLY = 0x10, FLUID_CHANNEL_BREATH_MONO = 0x20, FLUID_CHANNEL_BREATH_SYNC = 0x40 }
 Indicates the breath mode a channel is set to. More...
 
enum  fluid_basic_channel_modes {
  FLUID_CHANNEL_MODE_MASK = (FLUID_CHANNEL_OMNI_OFF | FLUID_CHANNEL_POLY_OFF), FLUID_CHANNEL_MODE_OMNION_POLY = FLUID_CHANNEL_MODE_MASK & (~FLUID_CHANNEL_OMNI_OFF & ~FLUID_CHANNEL_POLY_OFF), FLUID_CHANNEL_MODE_OMNION_MONO = FLUID_CHANNEL_MODE_MASK & (~FLUID_CHANNEL_OMNI_OFF & FLUID_CHANNEL_POLY_OFF), FLUID_CHANNEL_MODE_OMNIOFF_POLY = FLUID_CHANNEL_MODE_MASK & (FLUID_CHANNEL_OMNI_OFF & ~FLUID_CHANNEL_POLY_OFF),
  FLUID_CHANNEL_MODE_OMNIOFF_MONO = FLUID_CHANNEL_MODE_MASK & (FLUID_CHANNEL_OMNI_OFF | FLUID_CHANNEL_POLY_OFF)
}
 Indicates the mode a basic channel is set to. More...
 
enum  fluid_channel_legato_mode { FLUID_CHANNEL_LEGATO_MODE_RETRIGGER, FLUID_CHANNEL_LEGATO_MODE_MULTI_RETRIGGER }
 Interface to mono legato mode. More...
 
enum  fluid_channel_portamento_mode { FLUID_CHANNEL_PORTAMENTO_MODE_EACH_NOTE, FLUID_CHANNEL_PORTAMENTO_MODE_LEGATO_ONLY, FLUID_CHANNEL_PORTAMENTO_MODE_STACCATO_ONLY }
 Interface to portamento mode. More...
 

Functions

FLUIDSYNTH_API fluid_synth_tnew_fluid_synth (fluid_settings_t *settings)
 Create new FluidSynth instance. More...
 
FLUIDSYNTH_API void delete_fluid_synth (fluid_synth_t *synth)
 Delete a FluidSynth instance. More...
 
FLUIDSYNTH_API fluid_settings_tfluid_synth_get_settings (fluid_synth_t *synth)
 Get settings assigned to a synth. More...
 
FLUIDSYNTH_API int fluid_synth_noteon (fluid_synth_t *synth, int chan, int key, int vel)
 Send a note-on event to a FluidSynth object. More...
 
FLUIDSYNTH_API int fluid_synth_noteoff (fluid_synth_t *synth, int chan, int key)
 Sends a note-off event to a FluidSynth object. More...
 
FLUIDSYNTH_API int fluid_synth_cc (fluid_synth_t *synth, int chan, int ctrl, int val)
 Send a MIDI controller event on a MIDI channel. More...
 
FLUIDSYNTH_API int fluid_synth_get_cc (fluid_synth_t *synth, int chan, int ctrl, int *pval)
 Get current MIDI controller value on a MIDI channel. More...
 
FLUIDSYNTH_API int fluid_synth_sysex (fluid_synth_t *synth, const char *data, int len, char *response, int *response_len, int *handled, int dryrun)
 Process a MIDI SYSEX (system exclusive) message. More...
 
FLUIDSYNTH_API int fluid_synth_pitch_bend (fluid_synth_t *synth, int chan, int val)
 Set the MIDI pitch bend controller value on a MIDI channel. More...
 
FLUIDSYNTH_API int fluid_synth_get_pitch_bend (fluid_synth_t *synth, int chan, int *ppitch_bend)
 Get the MIDI pitch bend controller value on a MIDI channel. More...
 
FLUIDSYNTH_API int fluid_synth_pitch_wheel_sens (fluid_synth_t *synth, int chan, int val)
 Set MIDI pitch wheel sensitivity on a MIDI channel. More...
 
FLUIDSYNTH_API int fluid_synth_get_pitch_wheel_sens (fluid_synth_t *synth, int chan, int *pval)
 Get MIDI pitch wheel sensitivity on a MIDI channel. More...
 
FLUIDSYNTH_API int fluid_synth_program_change (fluid_synth_t *synth, int chan, int program)
 Send a program change event on a MIDI channel. More...
 
FLUIDSYNTH_API int fluid_synth_channel_pressure (fluid_synth_t *synth, int chan, int val)
 Set the MIDI channel pressure controller value. More...
 
FLUIDSYNTH_API int fluid_synth_key_pressure (fluid_synth_t *synth, int chan, int key, int val)
 Set the MIDI polyphonic key pressure controller value. More...
 
FLUIDSYNTH_API int fluid_synth_bank_select (fluid_synth_t *synth, int chan, int bank)
 Set instrument bank number on a MIDI channel. More...
 
FLUIDSYNTH_API int fluid_synth_sfont_select (fluid_synth_t *synth, int chan, int sfont_id)
 Set SoundFont ID on a MIDI channel. More...
 
FLUIDSYNTH_API int fluid_synth_program_select (fluid_synth_t *synth, int chan, int sfont_id, int bank_num, int preset_num)
 Select an instrument on a MIDI channel by SoundFont ID, bank and program numbers. More...
 
FLUIDSYNTH_API int fluid_synth_program_select_by_sfont_name (fluid_synth_t *synth, int chan, const char *sfont_name, int bank_num, int preset_num)
 Select an instrument on a MIDI channel by SoundFont name, bank and program numbers. More...
 
FLUIDSYNTH_API int fluid_synth_get_program (fluid_synth_t *synth, int chan, int *sfont_id, int *bank_num, int *preset_num)
 Get current SoundFont ID, bank number and program number for a MIDI channel. More...
 
FLUIDSYNTH_API int fluid_synth_unset_program (fluid_synth_t *synth, int chan)
 Set the preset of a MIDI channel to an unassigned state. More...
 
FLUIDSYNTH_API int fluid_synth_program_reset (fluid_synth_t *synth)
 Resend a bank select and a program change for every channel and assign corresponding instruments. More...
 
FLUIDSYNTH_API int fluid_synth_system_reset (fluid_synth_t *synth)
 Send MIDI system reset command (big red 'panic' button), turns off notes, resets controllers and restores initial basic channel configuration. More...
 
FLUIDSYNTH_API int fluid_synth_all_notes_off (fluid_synth_t *synth, int chan)
 Turn off all notes on a MIDI channel (put them into release phase). More...
 
FLUIDSYNTH_API int fluid_synth_all_sounds_off (fluid_synth_t *synth, int chan)
 Immediately stop all notes on a MIDI channel (skips release phase). More...
 
FLUIDSYNTH_API int fluid_synth_set_channel_type (fluid_synth_t *synth, int chan, int type)
 Set midi channel type. More...
 
FLUIDSYNTH_API fluid_preset_tfluid_synth_get_channel_preset (fluid_synth_t *synth, int chan)
 Get active preset on a MIDI channel. More...
 
FLUIDSYNTH_API int fluid_synth_start (fluid_synth_t *synth, unsigned int id, fluid_preset_t *preset, int audio_chan, int midi_chan, int key, int vel)
 Create and start voices using a preset and a MIDI note on event. More...
 
FLUIDSYNTH_API int fluid_synth_stop (fluid_synth_t *synth, unsigned int id)
 Stop notes for a given note event voice ID. More...
 
FLUIDSYNTH_API int fluid_synth_sfload (fluid_synth_t *synth, const char *filename, int reset_presets)
 Load a SoundFont file (filename is interpreted by SoundFont loaders). More...
 
FLUIDSYNTH_API int fluid_synth_sfreload (fluid_synth_t *synth, int id)
 Reload a SoundFont. More...
 
FLUIDSYNTH_API int fluid_synth_sfunload (fluid_synth_t *synth, int id, int reset_presets)
 Unload a SoundFont. More...
 
FLUIDSYNTH_API int fluid_synth_add_sfont (fluid_synth_t *synth, fluid_sfont_t *sfont)
 Add a SoundFont. More...
 
FLUIDSYNTH_API int fluid_synth_remove_sfont (fluid_synth_t *synth, fluid_sfont_t *sfont)
 Remove a SoundFont from the SoundFont stack without deleting it. More...
 
FLUIDSYNTH_API int fluid_synth_sfcount (fluid_synth_t *synth)
 Count number of loaded SoundFont files. More...
 
FLUIDSYNTH_API fluid_sfont_tfluid_synth_get_sfont (fluid_synth_t *synth, unsigned int num)
 Get SoundFont by index. More...
 
FLUIDSYNTH_API fluid_sfont_tfluid_synth_get_sfont_by_id (fluid_synth_t *synth, int id)
 Get SoundFont by ID. More...
 
FLUIDSYNTH_API fluid_sfont_tfluid_synth_get_sfont_by_name (fluid_synth_t *synth, const char *name)
 Get SoundFont by name. More...
 
FLUIDSYNTH_API int fluid_synth_set_bank_offset (fluid_synth_t *synth, int sfont_id, int offset)
 Offset the bank numbers of a loaded SoundFont, i.e. subtract offset from any bank number when assigning instruments. More...
 
FLUIDSYNTH_API int fluid_synth_get_bank_offset (fluid_synth_t *synth, int sfont_id)
 Get bank offset of a loaded SoundFont. More...
 
FLUIDSYNTH_API int fluid_synth_set_reverb (fluid_synth_t *synth, double roomsize, double damping, double width, double level)
 Set reverb parameters. More...
 
FLUIDSYNTH_API int fluid_synth_set_reverb_roomsize (fluid_synth_t *synth, double roomsize)
 Set reverb roomsize. More...
 
FLUIDSYNTH_API int fluid_synth_set_reverb_damp (fluid_synth_t *synth, double damping)
 Set reverb damping. More...
 
FLUIDSYNTH_API int fluid_synth_set_reverb_width (fluid_synth_t *synth, double width)
 Set reverb width. More...
 
FLUIDSYNTH_API int fluid_synth_set_reverb_level (fluid_synth_t *synth, double level)
 Set reverb level. More...
 
FLUIDSYNTH_API void fluid_synth_set_reverb_on (fluid_synth_t *synth, int on)
 Enable or disable reverb effect. More...
 
FLUIDSYNTH_API double fluid_synth_get_reverb_roomsize (fluid_synth_t *synth)
 Get reverb room size. More...
 
FLUIDSYNTH_API double fluid_synth_get_reverb_damp (fluid_synth_t *synth)
 Get reverb damping. More...
 
FLUIDSYNTH_API double fluid_synth_get_reverb_level (fluid_synth_t *synth)
 Get reverb level. More...
 
FLUIDSYNTH_API double fluid_synth_get_reverb_width (fluid_synth_t *synth)
 Get reverb width. More...
 
FLUIDSYNTH_API int fluid_synth_set_chorus (fluid_synth_t *synth, int nr, double level, double speed, double depth_ms, int type)
 Set chorus parameters. More...
 
FLUIDSYNTH_API int fluid_synth_set_chorus_nr (fluid_synth_t *synth, int nr)
 Set the chorus voice count. More...
 
FLUIDSYNTH_API int fluid_synth_set_chorus_level (fluid_synth_t *synth, double level)
 Set the chorus level. More...
 
FLUIDSYNTH_API int fluid_synth_set_chorus_speed (fluid_synth_t *synth, double speed)
 Set the chorus speed. More...
 
FLUIDSYNTH_API int fluid_synth_set_chorus_depth (fluid_synth_t *synth, double depth_ms)
 Set the chorus depth. More...
 
FLUIDSYNTH_API int fluid_synth_set_chorus_type (fluid_synth_t *synth, int type)
 Set the chorus type. More...
 
FLUIDSYNTH_API void fluid_synth_set_chorus_on (fluid_synth_t *synth, int on)
 Enable or disable chorus effect. More...
 
FLUIDSYNTH_API int fluid_synth_get_chorus_nr (fluid_synth_t *synth)
 Get chorus voice number (delay line count) value. More...
 
FLUIDSYNTH_API double fluid_synth_get_chorus_level (fluid_synth_t *synth)
 Get chorus level. More...
 
FLUIDSYNTH_API double fluid_synth_get_chorus_speed (fluid_synth_t *synth)
 Get chorus speed in Hz. More...
 
FLUIDSYNTH_API double fluid_synth_get_chorus_depth (fluid_synth_t *synth)
 Get chorus depth. More...
 
FLUIDSYNTH_API int fluid_synth_get_chorus_type (fluid_synth_t *synth)
 Get chorus waveform type. More...
 
FLUIDSYNTH_API int fluid_synth_count_midi_channels (fluid_synth_t *synth)
 Get the total count of MIDI channels. More...
 
FLUIDSYNTH_API int fluid_synth_count_audio_channels (fluid_synth_t *synth)
 Get the total count of audio channels. More...
 
FLUIDSYNTH_API int fluid_synth_count_audio_groups (fluid_synth_t *synth)
 Get the total number of allocated audio channels. More...
 
FLUIDSYNTH_API int fluid_synth_count_effects_channels (fluid_synth_t *synth)
 Get the total number of allocated effects channels. More...
 
FLUIDSYNTH_API int fluid_synth_count_effects_groups (fluid_synth_t *synth)
 Get the total number of allocated effects units. More...
 
FLUIDSYNTH_API void fluid_synth_set_sample_rate (fluid_synth_t *synth, float sample_rate)
 Set sample rate of the synth. More...
 
FLUIDSYNTH_API void fluid_synth_set_gain (fluid_synth_t *synth, float gain)
 Set synth output gain value. More...
 
FLUIDSYNTH_API float fluid_synth_get_gain (fluid_synth_t *synth)
 Get synth output gain value. More...
 
FLUIDSYNTH_API int fluid_synth_set_polyphony (fluid_synth_t *synth, int polyphony)
 Set synthesizer polyphony (max number of voices). More...
 
FLUIDSYNTH_API int fluid_synth_get_polyphony (fluid_synth_t *synth)
 Get current synthesizer polyphony (max number of voices). More...
 
FLUIDSYNTH_API int fluid_synth_get_active_voice_count (fluid_synth_t *synth)
 Get current number of active voices. More...
 
FLUIDSYNTH_API int fluid_synth_get_internal_bufsize (fluid_synth_t *synth)
 Get the internal synthesis buffer size value. More...
 
FLUIDSYNTH_API int fluid_synth_set_interp_method (fluid_synth_t *synth, int chan, int interp_method)
 Set synthesis interpolation method on one or all MIDI channels. More...
 
FLUIDSYNTH_API int fluid_synth_set_gen (fluid_synth_t *synth, int chan, int param, float value)
 Set a SoundFont generator (effect) value on a MIDI channel in real-time. More...
 
FLUIDSYNTH_API float fluid_synth_get_gen (fluid_synth_t *synth, int chan, int param)
 Get generator value assigned to a MIDI channel. More...
 
FLUIDSYNTH_API int fluid_synth_activate_key_tuning (fluid_synth_t *synth, int bank, int prog, const char *name, const double *pitch, int apply)
 Set the tuning of the entire MIDI note scale. More...
 
FLUIDSYNTH_API int fluid_synth_activate_octave_tuning (fluid_synth_t *synth, int bank, int prog, const char *name, const double *pitch, int apply)
 Activate an octave tuning on every octave in the MIDI note scale. More...
 
FLUIDSYNTH_API int fluid_synth_tune_notes (fluid_synth_t *synth, int bank, int prog, int len, const int *keys, const double *pitch, int apply)
 Set tuning values for one or more MIDI notes for an existing tuning. More...
 
FLUIDSYNTH_API int fluid_synth_activate_tuning (fluid_synth_t *synth, int chan, int bank, int prog, int apply)
 Activate a tuning scale on a MIDI channel. More...
 
FLUIDSYNTH_API int fluid_synth_deactivate_tuning (fluid_synth_t *synth, int chan, int apply)
 Clear tuning scale on a MIDI channel (use default equal tempered scale). More...
 
FLUIDSYNTH_API void fluid_synth_tuning_iteration_start (fluid_synth_t *synth)
 Start tuning iteration. More...
 
FLUIDSYNTH_API int fluid_synth_tuning_iteration_next (fluid_synth_t *synth, int *bank, int *prog)
 Advance to next tuning. More...
 
FLUIDSYNTH_API int fluid_synth_tuning_dump (fluid_synth_t *synth, int bank, int prog, char *name, int len, double *pitch)
 Get the entire note tuning for a given MIDI bank and program. More...
 
FLUIDSYNTH_API double fluid_synth_get_cpu_load (fluid_synth_t *synth)
 Get the synth CPU load value. More...
 
FLUIDSYNTH_API const char * fluid_synth_error (fluid_synth_t *synth)
 Get a textual representation of the last error. More...
 
FLUIDSYNTH_API int fluid_synth_add_default_mod (fluid_synth_t *synth, const fluid_mod_t *mod, int mode)
 Adds the specified modulator mod as default modulator to the synth. More...
 
FLUIDSYNTH_API int fluid_synth_remove_default_mod (fluid_synth_t *synth, const fluid_mod_t *mod)
 Removes the specified modulator mod from the synth's default modulator list. More...
 
FLUIDSYNTH_API int fluid_synth_write_s16 (fluid_synth_t *synth, int len, void *lout, int loff, int lincr, void *rout, int roff, int rincr)
 Synthesize a block of 16 bit audio samples to audio buffers. More...
 
FLUIDSYNTH_API int fluid_synth_write_float (fluid_synth_t *synth, int len, void *lout, int loff, int lincr, void *rout, int roff, int rincr)
 Synthesize a block of floating point audio samples to audio buffers. More...
 
FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_nwrite_float (fluid_synth_t *synth, int len, float **left, float **right, float **fx_left, float **fx_right)
 Synthesize a block of floating point audio to separate audio buffers (multichannel rendering). More...
 
FLUIDSYNTH_API int fluid_synth_process (fluid_synth_t *synth, int len, int nfx, float *fx[], int nout, float *out[])
 Synthesize floating point audio to stereo audio channels (implements the default interface fluid_audio_func_t). More...
 
FLUIDSYNTH_API void fluid_synth_add_sfloader (fluid_synth_t *synth, fluid_sfloader_t *loader)
 Add a SoundFont loader to the synth. More...
 
FLUIDSYNTH_API fluid_voice_tfluid_synth_alloc_voice (fluid_synth_t *synth, fluid_sample_t *sample, int channum, int key, int vel)
 Allocate a synthesis voice. More...
 
FLUIDSYNTH_API void fluid_synth_start_voice (fluid_synth_t *synth, fluid_voice_t *voice)
 Activate a voice previously allocated with fluid_synth_alloc_voice(). More...
 
FLUIDSYNTH_API void fluid_synth_get_voicelist (fluid_synth_t *synth, fluid_voice_t *buf[], int bufsize, int ID)
 Get list of currently playing voices. More...
 
FLUIDSYNTH_API int fluid_synth_handle_midi_event (void *data, fluid_midi_event_t *event)
 Handle MIDI event from MIDI router, used as a callback function. More...
 
FLUIDSYNTH_API int fluid_synth_set_custom_filter (fluid_synth_t *, int type, int flags)
 Configure a general-purpose IIR biquad filter. More...
 
FLUIDSYNTH_API fluid_ladspa_fx_tfluid_synth_get_ladspa_fx (fluid_synth_t *synth)
 Return the LADSPA effects instance used by FluidSynth. More...
 
FLUIDSYNTH_API int fluid_synth_reset_basic_channel (fluid_synth_t *synth, int chan)
 Disables and unassigns all channels from a basic channel group. More...
 
FLUIDSYNTH_API int fluid_synth_get_basic_channel (fluid_synth_t *synth, int chan, int *basic_chan_out, int *mode_chan_out, int *basic_val_out)
 Returns poly mono mode information of any MIDI channel. More...
 
FLUIDSYNTH_API int fluid_synth_set_basic_channel (fluid_synth_t *synth, int chan, int mode, int val)
 Sets a new basic channel group only. More...
 
FLUIDSYNTH_API int fluid_synth_set_legato_mode (fluid_synth_t *synth, int chan, int legatomode)
 API legato mode. More...
 
FLUIDSYNTH_API int fluid_synth_get_legato_mode (fluid_synth_t *synth, int chan, int *legatomode)
 Gets the legato mode of a channel. More...
 
FLUIDSYNTH_API int fluid_synth_set_portamento_mode (fluid_synth_t *synth, int chan, int portamentomode)
 API portamento mode. More...
 
FLUIDSYNTH_API int fluid_synth_get_portamento_mode (fluid_synth_t *synth, int chan, int *portamentomode)
 Gets the portamento mode of a channel. More...
 
FLUIDSYNTH_API int fluid_synth_set_breath_mode (fluid_synth_t *synth, int chan, int breathmode)
 API breath mode. More...
 
FLUIDSYNTH_API int fluid_synth_get_breath_mode (fluid_synth_t *synth, int chan, int *breathmode)
 Gets the breath mode of a channel. More...
 

Detailed Description

Embeddable SoundFont synthesizer.

You create a new synthesizer with new_fluid_synth() and you destroy if with delete_fluid_synth(). Use the settings 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 described below 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(), ...

Enumeration Type Documentation

◆ fluid_midi_channel_type

The midi channel type used by fluid_synth_set_channel_type()

Enumerator
CHANNEL_TYPE_MELODIC 

Melodic midi channel.

CHANNEL_TYPE_DRUM 

Drum midi channel.

◆ fluid_chorus_mod

Chorus modulation waveform type.

Enumerator
FLUID_CHORUS_MOD_SINE 

Sine wave chorus modulation.

FLUID_CHORUS_MOD_TRIANGLE 

Triangle wave chorus modulation.

◆ fluid_interp

Synthesis interpolation method.

Enumerator
FLUID_INTERP_NONE 

No interpolation: Fastest, but questionable audio quality.

FLUID_INTERP_LINEAR 

Straight-line interpolation: A bit slower, reasonable audio quality.

FLUID_INTERP_4THORDER 

Fourth-order interpolation, good quality, the default.

FLUID_INTERP_7THORDER 

Seventh-order interpolation.

FLUID_INTERP_DEFAULT 

Default interpolation method.

FLUID_INTERP_HIGHEST 

Highest interpolation method.

◆ fluid_synth_add_mod

Enum used with fluid_synth_add_default_mod() to specify how to handle duplicate modulators.

Enumerator
FLUID_SYNTH_OVERWRITE 

Overwrite any existing matching modulator.

FLUID_SYNTH_ADD 

Add (sum) modulator amounts.

◆ fluid_iir_filter_type

Specifies the type of filter to use for the custom IIR filter.

Enumerator
FLUID_IIR_DISABLED 

Custom IIR filter is not operating.

FLUID_IIR_LOWPASS 

Custom IIR filter is operating as low-pass filter.

FLUID_IIR_HIGHPASS 

Custom IIR filter is operating as high-pass filter.

◆ fluid_iir_filter_flags

Specifies optional settings to use for the custom IIR filter.

Enumerator
FLUID_IIR_Q_LINEAR 

The Soundfont spec requires the filter Q to be interpreted in dB.

If this flag is set the filter Q is instead assumed to be in a linear range

FLUID_IIR_Q_ZERO_OFF 

If this flag the filter is switched off if Q == 0 (prior to any transformation)

FLUID_IIR_NO_GAIN_AMP 

The Soundfont spec requires to correct the gain of the filter depending on the filter's Q.

If this flag is set the filter gain will not be corrected.

◆ fluid_channel_mode_flags

Interface to poly/mono mode variables.

Channel mode bits OR-ed together so that it matches with the midi spec: poly omnion (0), mono omnion (1), poly omnioff (2), mono omnioff (3)

Enumerator
FLUID_CHANNEL_POLY_OFF 

if flag is set, the basic channel is in mono on state, if not set poly is on

FLUID_CHANNEL_OMNI_OFF 

if flag is set, the basic channel is in omni off state, if not set omni is on

◆ fluid_channel_breath_flags

Indicates the breath mode a channel is set to.

Enumerator
FLUID_CHANNEL_BREATH_POLY 

when channel is poly, this flag indicates that the default velocity to initial attenuation modulator is replaced by a breath to initial attenuation modulator

FLUID_CHANNEL_BREATH_MONO 

when channel is mono, this flag indicates that the default velocity to initial attenuation modulator is replaced by a breath modulator

FLUID_CHANNEL_BREATH_SYNC 

when channel is mono, this flag indicates that the breath controler(MSB)triggers noteon/noteoff on the running note

◆ fluid_basic_channel_modes

Indicates the mode a basic channel is set to.

Enumerator
FLUID_CHANNEL_MODE_MASK 

Mask Poly and Omni bits of fluid_channel_mode_flags, usually only used internally.

FLUID_CHANNEL_MODE_OMNION_POLY 

corresponds to MIDI mode 0

FLUID_CHANNEL_MODE_OMNION_MONO 

corresponds to MIDI mode 1

FLUID_CHANNEL_MODE_OMNIOFF_POLY 

corresponds to MIDI mode 2

FLUID_CHANNEL_MODE_OMNIOFF_MONO 

corresponds to MIDI mode 3

◆ fluid_channel_legato_mode

Interface to mono legato mode.

Indicates the legato mode a channel is set to n1,n2,n3,.. is a legato passage. n1 is the first note, and n2,n3,n4 are played legato with previous note.

Enumerator
FLUID_CHANNEL_LEGATO_MODE_RETRIGGER 

Mode 0 - Release previous note, start a new note.

FLUID_CHANNEL_LEGATO_MODE_MULTI_RETRIGGER 

Mode 1 - On contiguous notes retrigger in attack section using current value, shape attack using current dynamic and make use of previous voices if any.

◆ fluid_channel_portamento_mode

Interface to portamento mode.

Indicates the portamento mode a channel is set to

Enumerator
FLUID_CHANNEL_PORTAMENTO_MODE_EACH_NOTE 

Mode 0 - Portamento on each note (staccato or legato)

FLUID_CHANNEL_PORTAMENTO_MODE_LEGATO_ONLY 

Mode 1 - Portamento only on legato note.

FLUID_CHANNEL_PORTAMENTO_MODE_STACCATO_ONLY 

Mode 2 - Portamento only on staccato note.

Function Documentation

◆ new_fluid_synth()

FLUIDSYNTH_API fluid_synth_t* new_fluid_synth ( fluid_settings_t settings)

◆ delete_fluid_synth()

FLUIDSYNTH_API 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.

References delete_fluid_mod(), and fluid_voice_is_playing().

Referenced by new_fluid_synth().

◆ fluid_synth_get_settings()

FLUIDSYNTH_API fluid_settings_t* fluid_synth_get_settings ( fluid_synth_t synth)

Get settings assigned to a synth.

Parameters
synthFluidSynth instance
Returns
FluidSynth settings which are assigned to the synth

Referenced by fluid_get_sysconf().

◆ fluid_synth_noteon()

FLUIDSYNTH_API int fluid_synth_noteon ( fluid_synth_t synth,
int  chan,
int  key,
int  vel 
)

Send a note-on event to a FluidSynth object.

Parameters
synthFluidSynth instance
chanMIDI channel number (0 to MIDI channel count - 1)
keyMIDI note number (0-127)
velMIDI velocity (0-127, 0=noteoff)
Returns
FLUID_OK on success, FLUID_FAILED otherwise
Examples:
example.c, fluidsynth_fx.c, and fluidsynth_simple.c.

References FLUID_FAILED, and FLUID_INFO.

Referenced by fluid_get_sysconf(), fluid_sequencer_register_fluidsynth(), and fluid_synth_handle_midi_event().

◆ fluid_synth_noteoff()

FLUIDSYNTH_API int fluid_synth_noteoff ( fluid_synth_t synth,
int  chan,
int  key 
)

Sends a note-off event to a FluidSynth object.

Parameters
synthFluidSynth instance
chanMIDI channel number (0 to MIDI channel count - 1)
keyMIDI note number (0-127)
Returns
FLUID_OK on success, FLUID_FAILED otherwise (may just mean that no voices matched the note off event)
Examples:
example.c.

References FLUID_FAILED, FLUID_OK, fluid_voice_get_channel(), fluid_voice_is_sostenuto(), and fluid_voice_is_sustained().

Referenced by fluid_get_sysconf(), fluid_sequencer_register_fluidsynth(), and fluid_synth_handle_midi_event().

◆ fluid_synth_cc()

FLUIDSYNTH_API int fluid_synth_cc ( fluid_synth_t synth,
int  chan,
int  num,
int  val 
)

Send a MIDI controller event on a MIDI channel.

Parameters
synthFluidSynth instance
chanMIDI channel number (0 to MIDI channel count - 1)
numMIDI controller number (0-127)
valMIDI controller value (0-127)
Returns
FLUID_OK on success, FLUID_FAILED otherwise
Note
This function supports MIDI Global Controllers which will be sent to all channels of the basic channel if this basic channel is in mode OmniOff/Mono. This is accomplished by sending the CC one MIDI channel below the basic channel of the receiver. Examples: let a synthesizer with 16 MIDI channels:
  • Let a basic channel 7 in mode 3 (Omni Off, Mono). If MIDI channel 6 is disabled it could be used as CC global for all channels belonging to basic channel 7.
  • Let a basic channel 0 in mode 3. If MIDI channel 15 is disabled it could be used as CC global for all channels belonging to basic channel 0.

References FLUID_CHANNEL_MODE_MASK, FLUID_CHANNEL_MODE_OMNIOFF_MONO, FLUID_CHANNEL_OMNI_OFF, FLUID_CHANNEL_POLY_OFF, FLUID_FAILED, FLUID_INFO, FLUID_OK, fluid_synth_activate_tuning(), GEN_COARSETUNE, and GEN_FINETUNE.

Referenced by fluid_get_sysconf(), fluid_sequencer_register_fluidsynth(), and fluid_synth_handle_midi_event().

◆ fluid_synth_get_cc()

FLUIDSYNTH_API int fluid_synth_get_cc ( fluid_synth_t synth,
int  chan,
int  num,
int *  pval 
)

Get current MIDI controller value on a MIDI channel.

Parameters
synthFluidSynth instance
chanMIDI channel number (0 to MIDI channel count - 1)
numMIDI controller number (0-127)
pvalLocation to store MIDI controller value (0-127)
Returns
FLUID_OK on success, FLUID_FAILED otherwise

References FLUID_FAILED, and FLUID_OK.

◆ fluid_synth_sysex()

FLUIDSYNTH_API int fluid_synth_sysex ( fluid_synth_t synth,
const char *  data,
int  len,
char *  response,
int *  response_len,
int *  handled,
int  dryrun 
)

Process a MIDI SYSEX (system exclusive) message.

Parameters
synthFluidSynth instance
dataBuffer containing SYSEX data (not including 0xF0 and 0xF7)
lenLength of data in buffer
responseBuffer to store response to or NULL to ignore
response_lenIN/OUT parameter, in: size of response buffer, out: amount of data written to response buffer (if FLUID_FAILED is returned and this value is non-zero, it indicates the response buffer is too small)
handledOptional location to store boolean value if message was recognized and handled or not (set to TRUE if it was handled)
dryrunTRUE to just do a dry run but not actually execute the SYSEX command (useful for checking if a SYSEX message would be handled)
Returns
FLUID_OK on success, FLUID_FAILED otherwise
Since
1.1.0

References FLUID_FAILED, FLUID_OK, fluid_synth_activate_octave_tuning(), fluid_synth_activate_tuning(), fluid_synth_tune_notes(), and fluid_synth_tuning_dump().

Referenced by fluid_synth_handle_midi_event().

◆ fluid_synth_pitch_bend()

FLUIDSYNTH_API int fluid_synth_pitch_bend ( fluid_synth_t synth,
int  chan,
int  val 
)

Set the MIDI pitch bend controller value on a MIDI channel.

Parameters
synthFluidSynth instance
chanMIDI channel number (0 to MIDI channel count - 1)
valMIDI pitch bend value (0-16383 with 8192 being center)
Returns
FLUID_OK on success, FLUID_FAILED otherwise

References FLUID_FAILED, FLUID_INFO, and FLUID_MOD_PITCHWHEEL.

Referenced by fluid_get_sysconf(), fluid_sequencer_register_fluidsynth(), and fluid_synth_handle_midi_event().

◆ fluid_synth_get_pitch_bend()

FLUIDSYNTH_API int fluid_synth_get_pitch_bend ( fluid_synth_t synth,
int  chan,
int *  ppitch_bend 
)

Get the MIDI pitch bend controller value on a MIDI channel.

Parameters
synthFluidSynth instance
chanMIDI channel number (0 to MIDI channel count - 1)
ppitch_bendLocation to store MIDI pitch bend value (0-16383 with 8192 being center)
Returns
FLUID_OK on success, FLUID_FAILED otherwise

References FLUID_FAILED, and FLUID_OK.

◆ fluid_synth_pitch_wheel_sens()

FLUIDSYNTH_API int fluid_synth_pitch_wheel_sens ( fluid_synth_t synth,
int  chan,
int  val 
)

Set MIDI pitch wheel sensitivity on a MIDI channel.

Parameters
synthFluidSynth instance
chanMIDI channel number (0 to MIDI channel count - 1)
valPitch wheel sensitivity value in semitones
Returns
FLUID_OK on success, FLUID_FAILED otherwise

References FLUID_FAILED, FLUID_INFO, and FLUID_MOD_PITCHWHEELSENS.

Referenced by fluid_sequencer_register_fluidsynth().

◆ fluid_synth_get_pitch_wheel_sens()

FLUIDSYNTH_API int fluid_synth_get_pitch_wheel_sens ( fluid_synth_t synth,
int  chan,
int *  pval 
)

Get MIDI pitch wheel sensitivity on a MIDI channel.

Parameters
synthFluidSynth instance
chanMIDI channel number (0 to MIDI channel count - 1)
pvalLocation to store pitch wheel sensitivity value in semitones
Returns
FLUID_OK on success, FLUID_FAILED otherwise
Since
Sometime AFTER v1.0 API freeze.

References FLUID_FAILED, FLUID_OK, fluid_sfont_get_id(), fluid_sfont_get_name(), and fluid_sfont_get_preset().

◆ fluid_synth_program_change()

FLUIDSYNTH_API int fluid_synth_program_change ( fluid_synth_t synth,
int  chan,
int  prognum 
)

Send a program change event on a MIDI channel.

Parameters
synthFluidSynth instance
chanMIDI channel number (0 to MIDI channel count - 1)
prognumMIDI program number (0-127)
Returns
FLUID_OK on success, FLUID_FAILED otherwise

References CHANNEL_TYPE_DRUM, FLUID_FAILED, FLUID_INFO, fluid_sfont_get_id(), and FLUID_WARN.

Referenced by fluid_get_sysconf(), fluid_sequencer_register_fluidsynth(), fluid_synth_handle_midi_event(), fluid_synth_program_reset(), and fluid_synth_unset_program().

◆ fluid_synth_channel_pressure()

FLUIDSYNTH_API int fluid_synth_channel_pressure ( fluid_synth_t synth,
int  chan,
int  val 
)

Set the MIDI channel pressure controller value.

Parameters
synthFluidSynth instance
chanMIDI channel number (0 to MIDI channel count - 1)
valMIDI channel pressure value (0-127)
Returns
FLUID_OK on success, FLUID_FAILED otherwise

References FLUID_FAILED, FLUID_INFO, and FLUID_MOD_CHANNELPRESSURE.

Referenced by fluid_sequencer_register_fluidsynth(), and fluid_synth_handle_midi_event().

◆ fluid_synth_key_pressure()

FLUIDSYNTH_API int fluid_synth_key_pressure ( fluid_synth_t synth,
int  chan,
int  key,
int  val 
)

Set the MIDI polyphonic key pressure controller value.

Parameters
synthFluidSynth instance
chanMIDI channel number (0 to MIDI channel count - 1)
keyMIDI key number (0-127)
valMIDI key pressure value (0-127)
Returns
FLUID_OK on success, FLUID_FAILED otherwise
Since
2.0.0

References FLUID_FAILED, FLUID_INFO, FLUID_MOD_KEYPRESSURE, and FLUID_OK.

Referenced by fluid_sequencer_register_fluidsynth(), and fluid_synth_handle_midi_event().

◆ fluid_synth_bank_select()

FLUIDSYNTH_API int fluid_synth_bank_select ( fluid_synth_t synth,
int  chan,
int  bank 
)

Set instrument bank number on a MIDI channel.

Parameters
synthFluidSynth instance
chanMIDI channel number (0 to MIDI channel count - 1)
bankMIDI bank number
Returns
FLUID_OK on success, FLUID_FAILED otherwise
Note
This function does not change the instrument currently assigned to chan, as it is usually called prior to fluid_synth_program_change(). If you still want instrument changes to take effect immediately, call fluid_synth_program_reset() after having set up the bank configuration.

References FLUID_FAILED, and FLUID_OK.

Referenced by fluid_get_sysconf(), and fluid_sequencer_register_fluidsynth().

◆ fluid_synth_sfont_select()

FLUIDSYNTH_API int fluid_synth_sfont_select ( fluid_synth_t synth,
int  chan,
int  sfont_id 
)

Set SoundFont ID on a MIDI channel.

Parameters
synthFluidSynth instance
chanMIDI channel number (0 to MIDI channel count - 1)
sfont_idID of a loaded SoundFont
Returns
FLUID_OK on success, FLUID_FAILED otherwise
Note
This function does not change the instrument currently assigned to chan, as it is usually called prior to fluid_synth_bank_select() or fluid_synth_program_change(). If you still want instrument changes to take effect immediately, call fluid_synth_program_reset() after having selected the soundfont.

References FLUID_FAILED, and FLUID_OK.

◆ fluid_synth_program_select()

FLUIDSYNTH_API int fluid_synth_program_select ( fluid_synth_t synth,
int  chan,
int  sfont_id,
int  bank_num,
int  preset_num 
)

Select an instrument on a MIDI channel by SoundFont ID, bank and program numbers.

Parameters
synthFluidSynth instance
chanMIDI channel number (0 to MIDI channel count - 1)
sfont_idID of a loaded SoundFont
bank_numMIDI bank number
preset_numMIDI program number
Returns
FLUID_OK on success, FLUID_FAILED otherwise

References FLUID_ERR, and FLUID_FAILED.

Referenced by fluid_get_sysconf(), and fluid_sequencer_register_fluidsynth().

◆ fluid_synth_program_select_by_sfont_name()

FLUIDSYNTH_API int fluid_synth_program_select_by_sfont_name ( fluid_synth_t synth,
int  chan,
const char *  sfont_name,
int  bank_num,
int  preset_num 
)

Select an instrument on a MIDI channel by SoundFont name, bank and program numbers.

Parameters
synthFluidSynth instance
chanMIDI channel number (0 to MIDI channel count - 1)
sfont_nameName of a loaded SoundFont
bank_numMIDI bank number
preset_numMIDI program number
Returns
FLUID_OK on success, FLUID_FAILED otherwise
Since
1.1.0

References FLUID_ERR, FLUID_FAILED, fluid_sfont_get_id(), and fluid_synth_set_sample_rate().

◆ fluid_synth_get_program()

FLUIDSYNTH_API int fluid_synth_get_program ( fluid_synth_t synth,
int  chan,
int *  sfont_id,
int *  bank_num,
int *  preset_num 
)

Get current SoundFont ID, bank number and program number for a MIDI channel.

Parameters
synthFluidSynth instance
chanMIDI channel number (0 to MIDI channel count - 1)
sfont_idLocation to store SoundFont ID
bank_numLocation to store MIDI bank number
preset_numLocation to store MIDI program number
Returns
FLUID_OK on success, FLUID_FAILED otherwise

References FLUID_FAILED, and FLUID_OK.

◆ fluid_synth_unset_program()

FLUIDSYNTH_API int fluid_synth_unset_program ( fluid_synth_t synth,
int  chan 
)

Set the preset of a MIDI channel to an unassigned state.

Parameters
synthFluidSynth instance
chanMIDI channel number (0 to MIDI channel count - 1)
Returns
FLUID_OK on success, FLUID_FAILED otherwise
Since
1.1.1
Note
Channel retains its SoundFont ID and bank numbers, while the program number is set to an "unset" state. MIDI program changes may re-assign a preset if one matches.

References FLUID_FAILED, and fluid_synth_program_change().

◆ fluid_synth_program_reset()

FLUIDSYNTH_API int fluid_synth_program_reset ( fluid_synth_t synth)

Resend a bank select and a program change for every channel and assign corresponding instruments.

Parameters
synthFluidSynth instance
Returns
FLUID_OK on success, FLUID_FAILED otherwise

This function is called mainly after a SoundFont has been loaded, unloaded or reloaded.

References FLUID_FAILED, FLUID_OK, and fluid_synth_program_change().

Referenced by fluid_get_sysconf(), fluid_synth_add_sfont(), fluid_synth_remove_sfont(), fluid_synth_sfload(), and fluid_synth_sfunload().

◆ fluid_synth_system_reset()

FLUIDSYNTH_API int fluid_synth_system_reset ( fluid_synth_t synth)

Send MIDI system reset command (big red 'panic' button), turns off notes, resets controllers and restores initial basic channel configuration.

Parameters
synthFluidSynth instance
Returns
FLUID_OK on success, FLUID_FAILED otherwise

References FLUID_CHANNEL_MODE_OMNION_POLY, FLUID_FAILED, FLUID_OK, fluid_synth_set_basic_channel(), and fluid_voice_get_channel().

Referenced by fluid_get_sysconf(), fluid_player_add_mem(), fluid_sequencer_register_fluidsynth(), and fluid_synth_handle_midi_event().

◆ fluid_synth_all_notes_off()

FLUIDSYNTH_API int fluid_synth_all_notes_off ( fluid_synth_t synth,
int  chan 
)

Turn off all notes on a MIDI channel (put them into release phase).

Parameters
synthFluidSynth instance
chanMIDI channel number (0 to MIDI channel count - 1), (chan=-1 selects all channels)
Returns
FLUID_OK on success, FLUID_FAILED otherwise
Since
1.1.4

References FLUID_FAILED, FLUID_OK, fluid_voice_get_channel(), and fluid_voice_is_playing().

Referenced by fluid_sequencer_register_fluidsynth().

◆ fluid_synth_all_sounds_off()

FLUIDSYNTH_API int fluid_synth_all_sounds_off ( fluid_synth_t synth,
int  chan 
)

Immediately stop all notes on a MIDI channel (skips release phase).

Parameters
synthFluidSynth instance
chanMIDI channel number (0 to MIDI channel count - 1), (chan=-1 selects all channels)
Returns
FLUID_OK on success, FLUID_FAILED otherwise
Since
1.1.4

References FLUID_FAILED, FLUID_OK, fluid_voice_get_channel(), and fluid_voice_is_playing().

Referenced by fluid_player_add_mem(), and fluid_sequencer_register_fluidsynth().

◆ fluid_synth_set_channel_type()

FLUIDSYNTH_API int fluid_synth_set_channel_type ( fluid_synth_t synth,
int  chan,
int  type 
)

Set midi channel type.

Parameters
synthFluidSynth instance
chanMIDI channel number (0 to MIDI channel count - 1)
typeMIDI channel type (fluid_midi_channel_type)
Returns
FLUID_OK on success, FLUID_FAILED otherwise
Since
1.1.4

References CHANNEL_TYPE_DRUM, CHANNEL_TYPE_MELODIC, FLUID_FAILED, and FLUID_OK.

◆ fluid_synth_get_channel_preset()

FLUIDSYNTH_API fluid_preset_t* fluid_synth_get_channel_preset ( fluid_synth_t synth,
int  chan 
)

Get active preset on a MIDI channel.

Parameters
synthFluidSynth instance
chanMIDI channel number (0 to MIDI channel count - 1)
Returns
Preset or NULL if no preset active on chan
Note
Should only be called from within synthesis thread, which includes SoundFont loader preset noteon methods. Not thread safe otherwise.

Referenced by fluid_get_sysconf().

◆ fluid_synth_start()

FLUIDSYNTH_API int fluid_synth_start ( fluid_synth_t synth,
unsigned int  id,
fluid_preset_t preset,
int  audio_chan,
int  chan,
int  key,
int  vel 
)

Create and start voices using a preset and a MIDI note on event.

Parameters
synthFluidSynth instance
idVoice group ID to use (can be used with fluid_synth_stop()).
presetPreset to synthesize
audio_chanUnused currently, set to 0
chanMIDI channel number (0 to MIDI channel count - 1)
keyMIDI note number (0-127)
velMIDI velocity number (1-127)
Returns
FLUID_OK on success, FLUID_FAILED otherwise
Note
Should only be called from within synthesis thread, which includes SoundFont loader preset noteon method.

References FLUID_FAILED.

◆ fluid_synth_stop()

FLUIDSYNTH_API int fluid_synth_stop ( fluid_synth_t synth,
unsigned int  id 
)

Stop notes for a given note event voice ID.

Parameters
synthFluidSynth instance
idVoice note event ID
Returns
FLUID_OK on success, FLUID_FAILED otherwise
Note
In FluidSynth versions prior to 1.1.0 FLUID_FAILED would be returned if no matching voice note event ID was found. Versions after 1.1.0 only return FLUID_FAILED if an error occurs.

References FLUID_FAILED, FLUID_OK, fluid_voice_get_id(), and fluid_voice_is_on().

◆ fluid_synth_sfload()

FLUIDSYNTH_API int fluid_synth_sfload ( fluid_synth_t synth,
const char *  filename,
int  reset_presets 
)

Load a SoundFont file (filename is interpreted by SoundFont loaders).

The newly loaded SoundFont will be put on top of the SoundFont stack. Presets are searched starting from the SoundFont on the top of the stack, working the way down the stack until a preset is found.

Parameters
synthFluidSynth instance
filenameFile to load
reset_presetsTRUE to re-assign presets for all MIDI channels (equivalent to calling fluid_synth_program_reset())
Returns
SoundFont ID on success, FLUID_FAILED on error
Examples:
example.c, fluidsynth_arpeggio.c, fluidsynth_fx.c, fluidsynth_metronome.c, fluidsynth_sfload_mem.c, and fluidsynth_simple.c.

References FLUID_ERR, FLUID_FAILED, and fluid_synth_program_reset().

Referenced by fluid_get_sysconf().

◆ fluid_synth_sfreload()

FLUIDSYNTH_API int fluid_synth_sfreload ( fluid_synth_t synth,
int  id 
)

Reload a SoundFont.

The SoundFont retains its ID and index on the SoundFont stack.

Parameters
synthFluidSynth instance
idID of SoundFont to reload
Returns
SoundFont ID on success, FLUID_FAILED on error

References FLUID_ERR, FLUID_FAILED, FLUID_OK, fluid_sfont_get_id(), fluid_sfont_get_name(), and fluid_synth_sfunload().

Referenced by fluid_get_sysconf().

◆ fluid_synth_sfunload()

FLUIDSYNTH_API int fluid_synth_sfunload ( fluid_synth_t synth,
int  id,
int  reset_presets 
)

Unload a SoundFont.

Parameters
synthFluidSynth instance
idID of SoundFont to unload
reset_presetsTRUE to re-assign presets for all MIDI channels
Returns
FLUID_OK on success, FLUID_FAILED on error

References FLUID_DBG, FLUID_ERR, FLUID_FAILED, FLUID_OK, fluid_sfont_get_id(), and fluid_synth_program_reset().

Referenced by fluid_get_sysconf(), and fluid_synth_sfreload().

◆ fluid_synth_add_sfont()

FLUIDSYNTH_API int fluid_synth_add_sfont ( fluid_synth_t synth,
fluid_sfont_t sfont 
)

Add a SoundFont.

The SoundFont will be added to the top of the SoundFont stack.

Parameters
synthFluidSynth instance
sfontSoundFont to add
Returns
New assigned SoundFont ID or FLUID_FAILED on error

References FLUID_FAILED, and fluid_synth_program_reset().

◆ fluid_synth_remove_sfont()

FLUIDSYNTH_API int fluid_synth_remove_sfont ( fluid_synth_t synth,
fluid_sfont_t sfont 
)

Remove a SoundFont from the SoundFont stack without deleting it.

Parameters
synthFluidSynth instance
sfontSoundFont to remove
Returns
FLUID_OK if sfont successfully removed, FLUID_FAILED otherwise

SoundFont is not freed and is left as the responsibility of the caller.

Note
The SoundFont should only be freed after there are no presets referencing it. This can only be ensured by the SoundFont loader and therefore this function should not normally be used.

References FLUID_FAILED, FLUID_OK, and fluid_synth_program_reset().

◆ fluid_synth_sfcount()

FLUIDSYNTH_API int fluid_synth_sfcount ( fluid_synth_t synth)

Count number of loaded SoundFont files.

Parameters
synthFluidSynth instance
Returns
Count of loaded SoundFont files.

Referenced by fluid_get_sysconf().

◆ fluid_synth_get_sfont()

FLUIDSYNTH_API fluid_sfont_t* fluid_synth_get_sfont ( fluid_synth_t synth,
unsigned int  num 
)

Get SoundFont by index.

Parameters
synthFluidSynth instance
numSoundFont index on the stack (starting from 0 for top of stack).
Returns
SoundFont instance or NULL if invalid index
Note
Caller should be certain that SoundFont is not deleted (unloaded) for the duration of use of the returned pointer.

Referenced by fluid_get_sysconf().

◆ fluid_synth_get_sfont_by_id()

FLUIDSYNTH_API fluid_sfont_t* fluid_synth_get_sfont_by_id ( fluid_synth_t synth,
int  id 
)

Get SoundFont by ID.

Parameters
synthFluidSynth instance
idSoundFont ID
Returns
SoundFont instance or NULL if invalid ID
Note
Caller should be certain that SoundFont is not deleted (unloaded) for the duration of use of the returned pointer.

References fluid_sfont_get_id().

Referenced by fluid_get_sysconf().

◆ fluid_synth_get_sfont_by_name()

FLUIDSYNTH_API fluid_sfont_t* fluid_synth_get_sfont_by_name ( fluid_synth_t synth,
const char *  name 
)

Get SoundFont by name.

Parameters
synthFluidSynth instance
nameName of SoundFont
Returns
SoundFont instance or NULL if invalid name
Since
1.1.0
Note
Caller should be certain that SoundFont is not deleted (unloaded) for the duration of use of the returned pointer.

References fluid_sfont_get_name().

◆ fluid_synth_set_bank_offset()

FLUIDSYNTH_API int fluid_synth_set_bank_offset ( fluid_synth_t synth,
int  sfont_id,
int  offset 
)

Offset the bank numbers of a loaded SoundFont, i.e. subtract offset from any bank number when assigning instruments.

Parameters
synthFluidSynth instance
sfont_idID of a loaded SoundFont
offsetBank offset value to apply to all instruments
Returns
FLUID_OK if the offset was set successfully, FLUID_FAILED otherwise

References FLUID_ERR, FLUID_FAILED, FLUID_OK, and fluid_sfont_get_id().

Referenced by fluid_get_sysconf().

◆ fluid_synth_get_bank_offset()

FLUIDSYNTH_API int fluid_synth_get_bank_offset ( fluid_synth_t synth,
int  sfont_id 
)

Get bank offset of a loaded SoundFont.

Parameters
synthFluidSynth instance
sfont_idID of a loaded SoundFont
Returns
SoundFont bank offset value

References FLUID_ERR, and fluid_sfont_get_id().

Referenced by fluid_get_sysconf().

◆ fluid_synth_set_reverb()

FLUIDSYNTH_API int fluid_synth_set_reverb ( fluid_synth_t synth,
double  roomsize,
double  damping,
double  width,
double  level 
)

Set reverb parameters.

Parameters
synthFluidSynth instance
roomsizeReverb room size value (0.0-1.0)
dampingReverb damping value (0.0-1.0)
widthReverb width value (0.0-100.0)
levelReverb level value (0.0-1.0)
Returns
FLUID_OK on success, FLUID_FAILED otherwise
Note
Not realtime safe and therefore should not be called from synthesis context at the risk of stalling audio output.

Referenced by fluid_synth_set_reverb_on().

◆ fluid_synth_set_reverb_roomsize()

FLUIDSYNTH_API int fluid_synth_set_reverb_roomsize ( fluid_synth_t synth,
double  roomsize 
)

Set reverb roomsize.

See fluid_synth_set_reverb() for further info.

Returns
FLUID_OK on success, FLUID_FAILED otherwise

Referenced by fluid_get_sysconf(), and fluid_synth_write_s16().

◆ fluid_synth_set_reverb_damp()

FLUIDSYNTH_API int fluid_synth_set_reverb_damp ( fluid_synth_t synth,
double  damping 
)

Set reverb damping.

See fluid_synth_set_reverb() for further info.

Returns
FLUID_OK on success, FLUID_FAILED otherwise

Referenced by fluid_get_sysconf(), and fluid_synth_write_s16().

◆ fluid_synth_set_reverb_width()

FLUIDSYNTH_API int fluid_synth_set_reverb_width ( fluid_synth_t synth,
double  width 
)

Set reverb width.

See fluid_synth_set_reverb() for further info.

Returns
FLUID_OK on success, FLUID_FAILED otherwise

Referenced by fluid_get_sysconf(), and fluid_synth_write_s16().

◆ fluid_synth_set_reverb_level()

FLUIDSYNTH_API int fluid_synth_set_reverb_level ( fluid_synth_t synth,
double  level 
)

Set reverb level.

See fluid_synth_set_reverb() for further info.

Returns
FLUID_OK on success, FLUID_FAILED otherwise

References FLUID_FAILED.

Referenced by fluid_get_sysconf(), and fluid_synth_write_s16().

◆ fluid_synth_set_reverb_on()

FLUIDSYNTH_API void fluid_synth_set_reverb_on ( fluid_synth_t synth,
int  on 
)

Enable or disable reverb effect.

Parameters
synthFluidSynth instance
onTRUE to enable reverb, FALSE to disable

References FLUID_FAILED, FLUID_OK, and fluid_synth_set_reverb().

Referenced by fluid_get_sysconf(), fluid_synth_write_s16(), and new_fluid_synth().

◆ fluid_synth_get_reverb_roomsize()

FLUIDSYNTH_API double fluid_synth_get_reverb_roomsize ( fluid_synth_t synth)

Get reverb room size.

Parameters
synthFluidSynth instance
Returns
Reverb room size (0.0-1.2)

◆ fluid_synth_get_reverb_damp()

FLUIDSYNTH_API double fluid_synth_get_reverb_damp ( fluid_synth_t synth)

Get reverb damping.

Parameters
synthFluidSynth instance
Returns
Reverb damping value (0.0-1.0)

◆ fluid_synth_get_reverb_level()

FLUIDSYNTH_API double fluid_synth_get_reverb_level ( fluid_synth_t synth)

Get reverb level.

Parameters
synthFluidSynth instance
Returns
Reverb level value (0.0-1.0)

◆ fluid_synth_get_reverb_width()

FLUIDSYNTH_API double fluid_synth_get_reverb_width ( fluid_synth_t synth)

Get reverb width.

Parameters
synthFluidSynth instance
Returns
Reverb width value (0.0-100.0)

◆ fluid_synth_set_chorus()

FLUIDSYNTH_API int fluid_synth_set_chorus ( fluid_synth_t synth,
int  nr,
double  level,
double  speed,
double  depth_ms,
int  type 
)

Set chorus parameters.

It should be turned on with fluid_synth_set_chorus_on(). Keep in mind, that the needed CPU time is proportional to 'nr'.

Parameters
synthFluidSynth instance
nrChorus voice count (0-99, CPU time consumption proportional to this value)
levelChorus level (0.0-10.0)
speedChorus speed in Hz (0.29-5.0)
depth_msChorus depth (max value depends on synth sample rate, 0.0-21.0 is safe for sample rate values up to 96KHz)
typeChorus waveform type (fluid_chorus_mod)
Returns
FLUID_OK on success, FLUID_FAILED otherwise

◆ fluid_synth_set_chorus_nr()

FLUIDSYNTH_API int fluid_synth_set_chorus_nr ( fluid_synth_t synth,
int  nr 
)

Set the chorus voice count.

See fluid_synth_set_chorus() for further info.

Returns
FLUID_OK on success, FLUID_FAILED otherwise

Referenced by fluid_get_sysconf(), and fluid_synth_write_s16().

◆ fluid_synth_set_chorus_level()

FLUIDSYNTH_API int fluid_synth_set_chorus_level ( fluid_synth_t synth,
double  level 
)

Set the chorus level.

See fluid_synth_set_chorus() for further info.

Returns
FLUID_OK on success, FLUID_FAILED otherwise

Referenced by fluid_get_sysconf(), and fluid_synth_write_s16().

◆ fluid_synth_set_chorus_speed()

FLUIDSYNTH_API int fluid_synth_set_chorus_speed ( fluid_synth_t synth,
double  speed 
)

Set the chorus speed.

See fluid_synth_set_chorus() for further info.

Returns
FLUID_OK on success, FLUID_FAILED otherwise

Referenced by fluid_get_sysconf(), and fluid_synth_write_s16().

◆ fluid_synth_set_chorus_depth()

FLUIDSYNTH_API int fluid_synth_set_chorus_depth ( fluid_synth_t synth,
double  depth_ms 
)

Set the chorus depth.

See fluid_synth_set_chorus() for further info.

Returns
FLUID_OK on success, FLUID_FAILED otherwise

Referenced by fluid_get_sysconf(), and fluid_synth_write_s16().

◆ fluid_synth_set_chorus_type()

FLUIDSYNTH_API int fluid_synth_set_chorus_type ( fluid_synth_t synth,
int  type 
)

Set the chorus type.

See fluid_synth_set_chorus() for further info.

Returns
FLUID_OK on success, FLUID_FAILED otherwise

References FLUID_FAILED.

◆ fluid_synth_set_chorus_on()

FLUIDSYNTH_API void fluid_synth_set_chorus_on ( fluid_synth_t synth,
int  on 
)

Enable or disable chorus effect.

Parameters
synthFluidSynth instance
onTRUE to enable chorus, FALSE to disable

Referenced by fluid_get_sysconf(), fluid_synth_write_s16(), and new_fluid_synth().

◆ fluid_synth_get_chorus_nr()

FLUIDSYNTH_API int fluid_synth_get_chorus_nr ( fluid_synth_t synth)

Get chorus voice number (delay line count) value.

Parameters
synthFluidSynth instance
Returns
Chorus voice count (0-99)

◆ fluid_synth_get_chorus_level()

FLUIDSYNTH_API double fluid_synth_get_chorus_level ( fluid_synth_t synth)

Get chorus level.

Parameters
synthFluidSynth instance
Returns
Chorus level value (0.0-10.0)

◆ fluid_synth_get_chorus_speed()

FLUIDSYNTH_API double fluid_synth_get_chorus_speed ( fluid_synth_t synth)

Get chorus speed in Hz.

Parameters
synthFluidSynth instance
Returns
Chorus speed in Hz (0.29-5.0)

◆ fluid_synth_get_chorus_depth()

FLUIDSYNTH_API double fluid_synth_get_chorus_depth ( fluid_synth_t synth)

Get chorus depth.

Parameters
synthFluidSynth instance
Returns
Chorus depth

◆ fluid_synth_get_chorus_type()

FLUIDSYNTH_API int fluid_synth_get_chorus_type ( fluid_synth_t synth)

Get chorus waveform type.

Parameters
synthFluidSynth instance
Returns
Chorus waveform type (fluid_chorus_mod)

References fluid_voice_get_channel(), fluid_voice_get_id(), fluid_voice_get_key(), fluid_voice_is_playing(), and fluid_voice_is_sostenuto().

◆ fluid_synth_count_midi_channels()

FLUIDSYNTH_API int fluid_synth_count_midi_channels ( fluid_synth_t synth)

Get the total count of MIDI channels.

Parameters
synthFluidSynth instance
Returns
Count of MIDI channels

Referenced by fluid_get_sysconf().

◆ fluid_synth_count_audio_channels()

FLUIDSYNTH_API int fluid_synth_count_audio_channels ( fluid_synth_t synth)

Get the total count of audio channels.

Parameters
synthFluidSynth instance
Returns
Count of audio channel stereo pairs (1 = 2 channels, 2 = 4, etc)
Examples:
fluidsynth_process.c.

◆ fluid_synth_count_audio_groups()

FLUIDSYNTH_API int fluid_synth_count_audio_groups ( fluid_synth_t synth)

Get the total number of allocated audio channels.

Usually identical to the number of audio channels. Can be employed by LADSPA effects subsystem.

Parameters
synthFluidSynth instance
Returns
Count of audio group stereo pairs (1 = 2 channels, 2 = 4, etc)

◆ fluid_synth_count_effects_channels()

FLUIDSYNTH_API int fluid_synth_count_effects_channels ( fluid_synth_t synth)

Get the total number of allocated effects channels.

Parameters
synthFluidSynth instance
Returns
Count of allocated effects channels
Examples:
fluidsynth_process.c.

◆ fluid_synth_count_effects_groups()

FLUIDSYNTH_API int fluid_synth_count_effects_groups ( fluid_synth_t synth)

Get the total number of allocated effects units.

Parameters
synthFluidSynth instance
Returns
Count of allocated effects units
Examples:
fluidsynth_process.c.

◆ fluid_synth_set_sample_rate()

FLUIDSYNTH_API void fluid_synth_set_sample_rate ( fluid_synth_t synth,
float  sample_rate 
)

Set sample rate of the synth.

Note
This function should only be used when no voices or notes are active.
Parameters
synthFluidSynth instance
sample_rateNew sample rate (Hz)
Since
1.1.2

References fluid_synth_set_gain().

Referenced by fluid_synth_program_select_by_sfont_name().

◆ fluid_synth_set_gain()

FLUIDSYNTH_API void fluid_synth_set_gain ( fluid_synth_t synth,
float  gain 
)

Set synth output gain value.

Parameters
synthFluidSynth instance
gainGain value (function clamps value to the range 0.0 to 10.0)

References fluid_voice_is_playing().

Referenced by fluid_get_sysconf(), and fluid_synth_set_sample_rate().

◆ fluid_synth_get_gain()

FLUIDSYNTH_API float fluid_synth_get_gain ( fluid_synth_t synth)

Get synth output gain value.

Parameters
synthFluidSynth instance
Returns
Synth gain value (0.0 to 10.0)

References fluid_synth_set_polyphony().

◆ fluid_synth_set_polyphony()

FLUIDSYNTH_API int fluid_synth_set_polyphony ( fluid_synth_t synth,
int  polyphony 
)

Set synthesizer polyphony (max number of voices).

Parameters
synthFluidSynth instance
polyphonyPolyphony to assign
Returns
FLUID_OK on success, FLUID_FAILED otherwise
Since
1.0.6

References FLUID_FAILED, FLUID_OK, and fluid_voice_is_playing().

Referenced by fluid_synth_get_gain().

◆ fluid_synth_get_polyphony()

FLUIDSYNTH_API int fluid_synth_get_polyphony ( fluid_synth_t synth)

Get current synthesizer polyphony (max number of voices).

Parameters
synthFluidSynth instance
Returns
Synth polyphony value.
Since
1.0.6

References FLUID_FAILED.

◆ fluid_synth_get_active_voice_count()

FLUIDSYNTH_API int fluid_synth_get_active_voice_count ( fluid_synth_t synth)

Get current number of active voices.

I.e. the no. of voices that have been started and have not yet finished. Unless called from synthesis context, this number does not necessarily have to be equal to the number of voices currently processed by the DSP loop, see below.

Parameters
synthFluidSynth instance
Returns
Number of currently active voices.
Since
1.1.0
Note
To generate accurate continuous statistics of the voice count, caller should ensure this function is called synchronously with the audio synthesis process. This can be done in the new_fluid_audio_driver2() audio callback function for example. Otherwise every call to this function may return different voice counts as it may change after any (concurrent) call to fluid_synth_write_*() made by e.g. an audio driver or the applications audio rendering thread.

References FLUID_FAILED.

Referenced by fluid_get_sysconf().

◆ fluid_synth_get_internal_bufsize()

FLUIDSYNTH_API int fluid_synth_get_internal_bufsize ( fluid_synth_t synth)

Get the internal synthesis buffer size value.

Parameters
synthFluidSynth instance
Returns
Internal buffer size in audio frames.

Audio is synthesized this number of frames at a time. Defaults to 64 frames.

◆ fluid_synth_set_interp_method()

FLUIDSYNTH_API int fluid_synth_set_interp_method ( fluid_synth_t synth,
int  chan,
int  interp_method 
)

Set synthesis interpolation method on one or all MIDI channels.

Parameters
synthFluidSynth instance
chanMIDI channel to set interpolation method on or -1 for all channels
interp_methodInterpolation method (fluid_interp)
Returns
FLUID_OK on success, FLUID_FAILED otherwise

References FLUID_ERR, FLUID_FAILED, and FLUID_OK.

Referenced by fluid_get_sysconf().

◆ fluid_synth_set_gen()

FLUIDSYNTH_API int fluid_synth_set_gen ( fluid_synth_t synth,
int  chan,
int  param,
float  value 
)

Set a SoundFont generator (effect) value on a MIDI channel in real-time.

Parameters
synthFluidSynth instance
chanMIDI channel number (0 to MIDI channel count - 1)
paramSoundFont generator ID (fluid_gen_type)
valueOffset or absolute generator value to assign to the MIDI channel
Returns
FLUID_OK on success, FLUID_FAILED otherwise

This function allows for setting all effect parameters in real time on a MIDI channel. Setting absolute to non-zero will cause the value to override any generator values set in the instruments played on the MIDI channel. See SoundFont 2.01 spec, paragraph 8.1.3, page 48 for details on SoundFont generator parameters and valid ranges.

References FLUID_FAILED, FLUID_OK, and fluid_voice_get_channel().

◆ fluid_synth_get_gen()

FLUIDSYNTH_API float fluid_synth_get_gen ( fluid_synth_t synth,
int  chan,
int  param 
)

Get generator value assigned to a MIDI channel.

Parameters
synthFluidSynth instance
chanMIDI channel number (0 to MIDI channel count - 1)
paramSoundFont generator ID (fluid_gen_type)
Returns
Current generator value assigned to MIDI channel

References FLUID_FAILED.

◆ fluid_synth_activate_key_tuning()

FLUIDSYNTH_API int fluid_synth_activate_key_tuning ( fluid_synth_t synth,
int  bank,
int  prog,
const char *  name,
const double *  pitch,
int  apply 
)

Set the tuning of the entire MIDI note scale.

Parameters
synthFluidSynth instance
bankTuning bank number (0-127), not related to MIDI instrument bank
progTuning preset number (0-127), not related to MIDI instrument program
nameLabel name for this tuning
pitchArray of pitch values (length of 128, each value is number of cents, for example normally note 0 is 0.0, 1 is 100.0, 60 is 6000.0, etc). Pass NULL to create a equal tempered (normal) scale.
applyTRUE to apply new tuning in realtime to existing notes which are using the replaced tuning (if any), FALSE otherwise
Returns
FLUID_OK on success, FLUID_FAILED otherwise
Since
1.1.0

References FLUID_FAILED, and FLUID_OK.

Referenced by fluid_get_sysconf().

◆ fluid_synth_activate_octave_tuning()

FLUIDSYNTH_API int fluid_synth_activate_octave_tuning ( fluid_synth_t synth,
int  bank,
int  prog,
const char *  name,
const double *  pitch,
int  apply 
)

Activate an octave tuning on every octave in the MIDI note scale.

Parameters
synthFluidSynth instance
bankTuning bank number (0-127), not related to MIDI instrument bank
progTuning preset number (0-127), not related to MIDI instrument program
nameLabel name for this tuning
pitchArray of pitch values (length of 12 for each note of an octave starting at note C, values are number of offset cents to add to the normal tuning amount)
applyTRUE to apply new tuning in realtime to existing notes which are using the replaced tuning (if any), FALSE otherwise
Returns
FLUID_OK on success, FLUID_FAILED otherwise
Since
1.1.0

References FLUID_FAILED, and FLUID_OK.

Referenced by fluid_synth_sysex().

◆ fluid_synth_tune_notes()

FLUIDSYNTH_API int fluid_synth_tune_notes ( fluid_synth_t synth,
int  bank,
int  prog,
int  len,
const int *  key,
const double *  pitch,
int  apply 
)

Set tuning values for one or more MIDI notes for an existing tuning.

Parameters
synthFluidSynth instance
bankTuning bank number (0-127), not related to MIDI instrument bank
progTuning preset number (0-127), not related to MIDI instrument program
lenNumber of MIDI notes to assign
keyArray of MIDI key numbers (length of 'len', values 0-127)
pitchArray of pitch values (length of 'len', values are number of cents from MIDI note 0)
applyTRUE to apply tuning change in realtime to existing notes using the specified tuning, FALSE otherwise
Returns
FLUID_OK on success, FLUID_FAILED otherwise
Note
Prior to version 1.1.0 it was an error to specify a tuning that didn't already exist. Starting with 1.1.0, the default equal tempered scale will be used as a basis, if no tuning exists for the given bank and prog.

References FLUID_FAILED, and FLUID_OK.

Referenced by fluid_get_sysconf(), and fluid_synth_sysex().

◆ fluid_synth_activate_tuning()

FLUIDSYNTH_API int fluid_synth_activate_tuning ( fluid_synth_t synth,
int  chan,
int  bank,
int  prog,
int  apply 
)

Activate a tuning scale on a MIDI channel.

Parameters
synthFluidSynth instance
chanMIDI channel number (0 to MIDI channel count - 1)
bankTuning bank number (0-127), not related to MIDI instrument bank
progTuning preset number (0-127), not related to MIDI instrument program
applyTRUE to apply tuning change to active notes, FALSE otherwise
Returns
FLUID_OK on success, FLUID_FAILED otherwise
Since
1.1.0
Note
A default equal tempered scale will be created, if no tuning exists on the given bank and prog.

References FLUID_FAILED, and FLUID_OK.

Referenced by fluid_get_sysconf(), fluid_synth_cc(), and fluid_synth_sysex().

◆ fluid_synth_deactivate_tuning()

FLUIDSYNTH_API int fluid_synth_deactivate_tuning ( fluid_synth_t synth,
int  chan,
int  apply 
)

Clear tuning scale on a MIDI channel (use default equal tempered scale).

Parameters
synthFluidSynth instance
chanMIDI channel number (0 to MIDI channel count - 1)
applyTRUE to apply tuning change to active notes, FALSE otherwise
Returns
FLUID_OK on success, FLUID_FAILED otherwise
Since
1.1.0

References FLUID_FAILED, and FLUID_OK.

Referenced by fluid_get_sysconf().

◆ fluid_synth_tuning_iteration_start()

FLUIDSYNTH_API void fluid_synth_tuning_iteration_start ( fluid_synth_t synth)

Start tuning iteration.

Parameters
synthFluidSynth instance

Referenced by fluid_get_sysconf().

◆ fluid_synth_tuning_iteration_next()

FLUIDSYNTH_API int fluid_synth_tuning_iteration_next ( fluid_synth_t synth,
int *  bank,
int *  prog 
)

Advance to next tuning.

Parameters
synthFluidSynth instance
bankLocation to store MIDI bank number of next tuning scale
progLocation to store MIDI program number of next tuning scale
Returns
1 if tuning iteration advanced, 0 if no more tunings

Referenced by fluid_get_sysconf().

◆ fluid_synth_tuning_dump()

FLUIDSYNTH_API int fluid_synth_tuning_dump ( fluid_synth_t synth,
int  bank,
int  prog,
char *  name,
int  len,
double *  pitch 
)

Get the entire note tuning for a given MIDI bank and program.

Parameters
synthFluidSynth instance
bankMIDI bank number of tuning
progMIDI program number of tuning
nameLocation to store tuning name or NULL to ignore
lenMaximum number of chars to store to 'name' (including NULL byte)
pitchArray to store tuning scale to or NULL to ignore (len of 128)
Returns
FLUID_OK if matching tuning was found, FLUID_FAILED otherwise

References FLUID_FAILED, and FLUID_OK.

Referenced by fluid_get_sysconf(), and fluid_synth_sysex().

◆ fluid_synth_get_cpu_load()

FLUIDSYNTH_API 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)

References FLUID_FAILED, FLUID_OK, FLUID_PANIC, fluid_voice_is_on(), fluid_voice_update_param(), and GEN_PITCH.

◆ fluid_synth_error()

FLUIDSYNTH_API 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.

◆ fluid_synth_add_default_mod()

FLUIDSYNTH_API int fluid_synth_add_default_mod ( fluid_synth_t synth,
const fluid_mod_t mod,
int  mode 
)

Adds the specified modulator mod as default modulator to the synth.

mod will take effect for any subsequently created voice.

Parameters
synthFluidSynth instance
modModulator info (values copied, passed in object can be freed immediately afterwards)
modeDetermines how to handle an existing identical modulator (fluid_synth_add_mod)
Returns
FLUID_OK on success, FLUID_FAILED otherwise
Note
Not realtime safe (due to internal memory allocation) and therefore should not be called from synthesis context at the risk of stalling audio output.

References FLUID_FAILED, fluid_mod_clone(), fluid_mod_test_identity(), FLUID_OK, FLUID_SYNTH_ADD, FLUID_SYNTH_OVERWRITE, and new_fluid_mod().

Referenced by new_fluid_synth().

◆ fluid_synth_remove_default_mod()

FLUIDSYNTH_API int fluid_synth_remove_default_mod ( fluid_synth_t synth,
const fluid_mod_t mod 
)

Removes the specified modulator mod from the synth's default modulator list.

fluid_mod_test_identity() will be used to test modulator matching.

Parameters
synthsynth instance
modThe modulator to remove
Returns
FLUID_OK if a matching modulator was found and successfully removed, FLUID_FAILED otherwise
Note
Not realtime safe (due to internal memory allocation) and therefore should not be called from synthesis context at the risk of stalling audio output.

References delete_fluid_mod(), FLUID_FAILED, fluid_mod_test_identity(), and FLUID_OK.

◆ fluid_synth_write_s16()

FLUIDSYNTH_API int fluid_synth_write_s16 ( fluid_synth_t synth,
int  len,
void *  lout,
int  loff,
int  lincr,
void *  rout,
int  roff,
int  rincr 
)

Synthesize a block of 16 bit audio samples to audio buffers.

Parameters
synthFluidSynth instance
lenCount of audio frames to synthesize
loutArray of 16 bit words to store left channel of audio
loffOffset index in 'lout' for first sample
lincrIncrement between samples stored to 'lout'
routArray of 16 bit words to store right channel of audio
roffOffset index in 'rout' for first sample
rincrIncrement between samples stored to 'rout'
Returns
FLUID_OK on success, FLUID_FAILED otherwise

Useful for storing interleaved stereo (lout = rout, loff = 0, roff = 1, lincr = 2, rincr = 2).

Note
Should only be called from synthesis thread.
Reverb and Chorus are mixed to lout resp. rout.
Dithering is performed when converting from internal floating point to 16 bit audio.

References FLUID_DBG, fluid_synth_set_chorus_depth(), fluid_synth_set_chorus_level(), fluid_synth_set_chorus_nr(), fluid_synth_set_chorus_on(), fluid_synth_set_chorus_speed(), fluid_synth_set_reverb_damp(), fluid_synth_set_reverb_level(), fluid_synth_set_reverb_on(), fluid_synth_set_reverb_roomsize(), fluid_synth_set_reverb_width(), fluid_voice_get_channel(), fluid_voice_get_id(), and fluid_voice_get_key().

Referenced by fluid_file_renderer_process_block().

◆ fluid_synth_write_float()

FLUIDSYNTH_API int fluid_synth_write_float ( fluid_synth_t synth,
int  len,
void *  lout,
int  loff,
int  lincr,
void *  rout,
int  roff,
int  rincr 
)

Synthesize a block of floating point audio samples to audio buffers.

Parameters
synthFluidSynth instance
lenCount of audio frames to synthesize
loutArray of floats to store left channel of audio
loffOffset index in 'lout' for first sample
lincrIncrement between samples stored to 'lout'
routArray of floats to store right channel of audio
roffOffset index in 'rout' for first sample
rincrIncrement between samples stored to 'rout'
Returns
FLUID_OK on success, FLUID_FAILED otherwise

Useful for storing interleaved stereo (lout = rout, loff = 0, roff = 1, lincr = 2, rincr = 2).

Note
Should only be called from synthesis thread.
Reverb and Chorus are mixed to lout resp. rout.

References FLUID_FAILED, and FLUID_OK.

Referenced by fluid_file_renderer_process_block().

◆ fluid_synth_nwrite_float()

FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_nwrite_float ( fluid_synth_t synth,
int  len,
float **  left,
float **  right,
float **  fx_left,
float **  fx_right 
)

Synthesize a block of floating point audio to separate audio buffers (multichannel rendering).

First effect channel used by reverb, second for chorus.

Parameters
synthFluidSynth instance
lenCount of audio frames to synthesize
leftArray of float buffers to store left channel of planar audio (as many as synth.audio-channels buffers, each of len in size)
rightArray of float buffers to store right channel of planar audio (size: dito)
fx_leftSince 1.1.7: If not NULL, array of float buffers to store left effect channels (as many as synth.effects-channels buffers, each of len in size)
fx_rightSince 1.1.7: If not NULL, array of float buffers to store right effect channels (size: dito)
Returns
FLUID_OK on success, FLUID_FAILED otherwise
Note
Should only be called from synthesis thread.
Deprecated:
fluid_synth_nwrite_float() is deprecated and will be removed in a future release. It may continue to work or it may return FLUID_FAILED in the future. Consider using the more powerful and flexible fluid_synth_process().

Usage example:

const int FramesToRender = 64;
int channels;
// retrieve number of stereo audio channels
fluid_settings_getint(settings, "synth.audio-channels", &channels);
// we need twice as many (mono-)buffers
channels *= 2;
// fluid_synth_nwrite_float renders planar audio, e.g. if synth.audio-channels==16: each midi channel gets rendered to its own stereo buffer, rather than having one buffer and interleaved PCM
float** mix_buf = new float*[channels];
for(int i = 0; i < channels; i++)
{
mix_buf[i] = new float[FramesToRender];
}
// retrieve number of (stereo) effect channels (internally hardcoded to reverb (first chan) and chrous (second chan))
fluid_settings_getint(settings, "synth.effects-channels", &channels);
channels *= 2;
float** fx_buf = new float*[channels];
for(int i = 0; i < channels; i++)
{
fx_buf[i] = new float[FramesToRender];
}
float** mix_buf_l = mix_buf;
float** mix_buf_r = &mix_buf[channels/2];
float** fx_buf_l = fx_buf;
float** fx_buf_r = &fx_buf[channels/2];
fluid_synth_nwrite_float(synth, FramesToRender, mix_buf_l, mix_buf_r, fx_buf_l, fx_buf_r)

References FLUID_FAILED, and FLUID_OK.

◆ fluid_synth_process()

FLUIDSYNTH_API int fluid_synth_process ( fluid_synth_t synth,
int  len,
int  nfx,
float *  fx[],
int  nout,
float *  out[] 
)

Synthesize floating point audio to stereo audio channels (implements the default interface fluid_audio_func_t).

Synthesize and mix audio to a given number of planar audio buffers. Therefore pass nout = N*2 float buffers to out in order to render the synthesized audio to N stereo channels. Each float buffer must be able to hold len elements.

out contains an array of planar buffers for normal, dry, stereo audio (alternating left and right). Like:

out[0] = left_buffer_audio_channel_0
out[1] = right_buffer_audio_channel_0
out[2] = left_buffer_audio_channel_1
out[3] = right_buffer_audio_channel_1
...
out[ (i * 2 + 0) % nout ] = left_buffer_audio_channel_i
out[ (i * 2 + 1) % nout ] = right_buffer_audio_channel_i

for zero-based channel index i. The buffer layout of fx used for storing effects like reverb and chorus looks similar:

fx[0] = left_buffer_channel_of_reverb_unit_0
fx[1] = right_buffer_channel_of_reverb_unit_0
fx[2] = left_buffer_channel_of_chorus_unit_0
fx[3] = right_buffer_channel_of_chorus_unit_0
fx[4] = left_buffer_channel_of_reverb_unit_1
fx[5] = right_buffer_channel_of_reverb_unit_1
fx[6] = left_buffer_channel_of_chorus_unit_1
fx[7] = right_buffer_channel_of_chorus_unit_1
fx[8] = left_buffer_channel_of_reverb_unit_2
...
fx[ ((k * fluid_synth_count_effects_channels() + j) * 2 + 0) % nfx ] = left_buffer_for_effect_channel_j_of_unit_k
fx[ ((k * fluid_synth_count_effects_channels() + j) * 2 + 1) % nfx ] = right_buffer_for_effect_channel_j_of_unit_k

where 0 <= k < fluid_synth_count_effects_groups() is a zero-based index denoting the effects unit and 0 <= j < fluid_synth_count_effects_channels() is a zero-based index denoting the effect channel within unit k.

Any voice playing is assigned to audio channels based on the MIDI channel its playing on. Let chan be the zero-based MIDI channel index an arbitrary voice is playing on. To determine the audio channel and effects unit it is going to be rendered to use:

i = chan % fluid_synth_count_audio_groups()

k = chan % fluid_synth_count_effects_groups()

Parameters
synthFluidSynth instance
lenCount of audio frames to synthesize and store in every single buffer provided by out and fx.
nfxCount of arrays in fx. Must be a multiple of 2 (because of stereo) and in the range 0 <= nfx/2 <= (fluid_synth_count_effects_channels() * fluid_synth_count_effects_groups()).
fxArray of buffers to store effects audio to. Buffers may alias with buffers of out. NULL buffers are permitted and will cause to skip mixing any audio into that buffer.
noutCount of arrays in out. Must be a multiple of 2 (because of stereo) and in the range 0 <= nout/2 <= fluid_synth_count_audio_channels().
outArray of buffers to store (dry) audio to. Buffers may alias with buffers of fx. NULL buffers are permitted and will cause to skip mixing any audio into that buffer.
Returns
FLUID_OK on success, FLUID_FAILED otherwise.
Note
The owner of the sample buffers must zero them out before calling this function, because any synthesized audio is mixed (i.e. added) to the buffers. E.g. if fluid_synth_process() is called from a custom audio driver process function (see new_fluid_audio_driver2()), the audio driver takes care of zeroing the buffers.
Note
No matter how many buffers you pass in, fluid_synth_process() will always render all audio channels to the buffers in out and all effects channels to the buffers in fx, provided that nout > 0 and nfx > 0 respectively. If nout/2 < fluid_synth_count_audio_channels() it will wrap around. Same is true for effects audio if nfx/2 < (fluid_synth_count_effects_channels() * fluid_synth_count_effects_groups()). See usage examples below.
Note
Should only be called from synthesis thread.
Examples:
fluidsynth_fx.c, and fluidsynth_process.c.

References FLUID_FAILED, and FLUID_OK.

◆ fluid_synth_add_sfloader()

FLUIDSYNTH_API void fluid_synth_add_sfloader ( fluid_synth_t synth,
fluid_sfloader_t loader 
)

Add a SoundFont loader to the synth.

This function takes ownership of loader and frees it automatically upon synth destruction.

Parameters
synthFluidSynth instance
loaderLoader API structure

SoundFont loaders are used to add custom instrument loading to FluidSynth. The caller supplied functions for loading files, allocating presets, retrieving information on them and synthesizing note-on events. Using this method even non SoundFont instruments can be synthesized, although limited to the SoundFont synthesis model.

Note
Should only be called before any SoundFont files are loaded.
Examples:
fluidsynth_sfload_mem.c.

Referenced by new_fluid_synth().

◆ fluid_synth_alloc_voice()

FLUIDSYNTH_API fluid_voice_t* fluid_synth_alloc_voice ( fluid_synth_t synth,
fluid_sample_t sample,
int  chan,
int  key,
int  vel 
)

Allocate a synthesis voice.

Parameters
synthFluidSynth instance
sampleSample to assign to the voice
chanMIDI channel number (0 to MIDI channel count - 1)
keyMIDI note number for the voice (0-127)
velMIDI velocity for the voice (0-127)
Returns
Allocated synthesis voice or NULL on error

This function is called by a SoundFont's preset in response to a noteon event. The returned voice comes with default modulators and generators. A single noteon event may create any number of voices, when the preset is layered.

Note
Should only be called from within synthesis thread, which includes SoundFont loader preset noteon method.

References FLUID_CHANNEL_BREATH_MONO, FLUID_CHANNEL_BREATH_POLY, FLUID_DBG, FLUID_INFO, fluid_mod_test_identity(), FLUID_OK, FLUID_VOICE_DEFAULT, fluid_voice_get_channel(), fluid_voice_get_id(), fluid_voice_is_playing(), FLUID_WARN, and GEN_EXCLUSIVECLASS.

◆ fluid_synth_start_voice()

FLUIDSYNTH_API void fluid_synth_start_voice ( fluid_synth_t synth,
fluid_voice_t voice 
)

Activate a voice previously allocated with fluid_synth_alloc_voice().

Parameters
synthFluidSynth instance
voiceVoice to activate

This function is called by a SoundFont's preset in response to a noteon event. Exclusive classes are processed here.

Note
Should only be called from within synthesis thread, which includes SoundFont loader preset noteon method.

Referenced by new_fluid_defsfloader().

◆ fluid_synth_get_voicelist()

FLUIDSYNTH_API void fluid_synth_get_voicelist ( fluid_synth_t synth,
fluid_voice_t buf[],
int  bufsize,
int  id 
)

Get list of currently playing voices.

Parameters
synthFluidSynth instance
bufArray to store voices to (NULL terminated if not filled completely)
bufsizeCount of indexes in buf
idVoice ID to search for or < 0 to return list of all playing voices
Note
Should only be called from within synthesis thread, which includes SoundFont loader preset noteon methods. Voices are only guaranteed to remain unchanged until next synthesis process iteration.

References fluid_voice_is_playing().

◆ fluid_synth_handle_midi_event()

FLUIDSYNTH_API int fluid_synth_handle_midi_event ( void *  data,
fluid_midi_event_t event 
)

◆ fluid_synth_set_custom_filter()

FLUIDSYNTH_API int fluid_synth_set_custom_filter ( fluid_synth_t synth,
int  type,
int  flags 
)

Configure a general-purpose IIR biquad filter.

This is an optional, additional filter that operates independently from the default low-pass filter required by the Soundfont2 standard. By default this filter is off (FLUID_IIR_DISABLED).

Parameters
synthFluidSynth instance
typeType of the IIR filter to use (see fluid_iir_filter_type)
flagsAdditional flags to customize this filter or zero to stay with the default (see fluid_iir_filter_flags)
Returns
FLUID_OK if the settings have been successfully applied, otherwise FLUID_FAILED

References FLUID_FAILED, and FLUID_IIR_DISABLED.

◆ fluid_synth_get_ladspa_fx()

FLUIDSYNTH_API fluid_ladspa_fx_t* fluid_synth_get_ladspa_fx ( fluid_synth_t synth)

Return the LADSPA effects instance used by FluidSynth.

Parameters
synthFluidSynth instance
Returns
pointer to LADSPA fx or NULL if compiled without LADSPA support or LADSPA is not active

◆ fluid_synth_reset_basic_channel()

FLUIDSYNTH_API int fluid_synth_reset_basic_channel ( fluid_synth_t synth,
int  chan 
)

Disables and unassigns all channels from a basic channel group.

Parameters
synthThe synth instance.
chanThe basic channel of the group to reset or -1 to reset all channels.
Note
By default (i.e. on creation after new_fluid_synth() and after fluid_synth_system_reset()) a synth instance has one basic channel at channel 0 in mode FLUID_CHANNEL_MODE_OMNION_POLY. All other channels belong to this basic channel group. Make sure to call this function before setting any custom basic channel setup.
Returns
  • FLUID_OK on success.
  • FLUID_FAILED
    • synth is NULL.
    • chan is outside MIDI channel count.
    • chan isn't a basic channel.

References FLUID_CHANNEL_MODE_OMNIOFF_POLY, FLUID_FAILED, and FLUID_OK.

◆ fluid_synth_get_basic_channel()

FLUIDSYNTH_API int fluid_synth_get_basic_channel ( fluid_synth_t synth,
int  chan,
int *  basic_chan_out,
int *  mode_out,
int *  val_out 
)

Returns poly mono mode information of any MIDI channel.

Parameters
synththe synth instance
chanMIDI channel number (0 to MIDI channel count - 1)
basic_chan_outBuffer to store the basic channel chan belongs to or FLUID_FAILED if chan is disabled.
mode_outBuffer to store the mode of chan (see fluid_basic_channel_modes) or FLUID_FAILED if chan is disabled.
val_outBuffer to store the total number of channels in this basic channel group or FLUID_FAILED if chan is disabled.
Note
If any of basic_chan_out, mode_out, val_out pointer is NULL the corresponding information isn't returned.
Returns

References FLUID_CHANNEL_MODE_MASK, FLUID_FAILED, and FLUID_OK.

Referenced by fluid_get_sysconf().

◆ fluid_synth_set_basic_channel()

FLUIDSYNTH_API int fluid_synth_set_basic_channel ( fluid_synth_t synth,
int  chan,
int  mode,
int  val 
)

Sets a new basic channel group only.

The function doesn't allow to change an existing basic channel.

The function fails if any channel overlaps any existing basic channel group. To make room if necessary, basic channel groups can be cleared using fluid_synth_reset_basic_channel().

Parameters
synththe synth instance.
chanthe basic Channel number (0 to MIDI channel count-1).
modethe MIDI mode to use for chan (see fluid_basic_channel_modes).
valnumber of channels in the group.
Note
val is only relevant for mode FLUID_CHANNEL_MODE_OMNION_POLY, FLUID_CHANNEL_MODE_OMNION_MONO and FLUID_CHANNEL_MODE_OMNIOFF_MONO. A value of 0 means all possible channels from chan to to next basic channel minus 1 (if any) or to MIDI channel count minus 1. Val is ignored for FLUID_CHANNEL_MODE_OMNIOFF_POLY as this mode implies a group of only one channel.
Returns
  • FLUID_OK on success.
  • FLUID_FAILED
    • synth is NULL.
    • chan is outside MIDI channel count.
    • mode is invalid.
    • val has a number of channels overlapping another basic channel group or been above MIDI channel count.
    • When the function fails, any existing basic channels aren't modified.

References FLUID_FAILED.

Referenced by fluid_synth_system_reset().

◆ fluid_synth_set_legato_mode()

FLUIDSYNTH_API int fluid_synth_set_legato_mode ( fluid_synth_t synth,
int  chan,
int  legatomode 
)

API legato mode.

Sets the legato mode of a channel.

Parameters
synththe synth instance.
chanMIDI channel number (0 to MIDI channel count - 1).
legatomodeThe legato mode as indicated by fluid_channel_legato_mode.
Returns
  • FLUID_OK on success.
  • FLUID_FAILED
    • synth is NULL.
    • chan is outside MIDI channel count.
    • legatomode is invalid.

References FLUID_FAILED.

◆ fluid_synth_get_legato_mode()

FLUIDSYNTH_API int fluid_synth_get_legato_mode ( fluid_synth_t synth,
int  chan,
int *  legatomode 
)

Gets the legato mode of a channel.

Parameters
synththe synth instance.
chanMIDI channel number (0 to MIDI channel count - 1).
legatomodeThe legato mode as indicated by fluid_channel_legato_mode.
Returns
  • FLUID_OK on success.
  • FLUID_FAILED
    • synth is NULL.
    • chan is outside MIDI channel count.
    • legatomode is NULL.

References FLUID_FAILED, and FLUID_OK.

◆ fluid_synth_set_portamento_mode()

FLUIDSYNTH_API int fluid_synth_set_portamento_mode ( fluid_synth_t synth,
int  chan,
int  portamentomode 
)

API portamento mode.

Sets the portamento mode of a channel.

Parameters
synththe synth instance.
chanMIDI channel number (0 to MIDI channel count - 1).
portamentomodeThe portamento mode as indicated by fluid_channel_portamento_mode.
Returns
  • FLUID_OK on success.
  • FLUID_FAILED
    • synth is NULL.
    • chan is outside MIDI channel count.
    • portamentomode is invalid.

References FLUID_FAILED.

◆ fluid_synth_get_portamento_mode()

FLUIDSYNTH_API int fluid_synth_get_portamento_mode ( fluid_synth_t synth,
int  chan,
int *  portamentomode 
)

Gets the portamento mode of a channel.

Parameters
synththe synth instance.
chanMIDI channel number (0 to MIDI channel count - 1).
portamentomodePointer to the portamento mode as indicated by fluid_channel_portamento_mode.
Returns
  • FLUID_OK on success.
  • FLUID_FAILED
    • synth is NULL.
    • chan is outside MIDI channel count.
    • portamentomode is NULL.

References FLUID_FAILED, and FLUID_OK.

◆ fluid_synth_set_breath_mode()

FLUIDSYNTH_API int fluid_synth_set_breath_mode ( fluid_synth_t synth,
int  chan,
int  breathmode 
)

API breath mode.

Sets the breath mode of a channel.

Parameters
synththe synth instance.
chanMIDI channel number (0 to MIDI channel count - 1).
breathmodeThe breath mode as indicated by fluid_channel_breath_flags.
Returns

References FLUID_FAILED, and FLUID_OK.

◆ fluid_synth_get_breath_mode()

FLUIDSYNTH_API int fluid_synth_get_breath_mode ( fluid_synth_t synth,
int  chan,
int *  breathmode 
)

Gets the breath mode of a channel.

Parameters
synththe synth instance.
chanMIDI channel number (0 to MIDI channel count - 1).
breathmodePointer to the returned breath mode as indicated by fluid_channel_breath_flags.
Returns
  • FLUID_OK on success.
  • FLUID_FAILED
    • synth is NULL.
    • chan is outside MIDI channel count.
    • breathmode is NULL.

References FLUID_FAILED, and FLUID_OK.