synth.h File Reference

Embeddable SoundFont synthesizer. More...

Data Structures

struct  _fluid_synth_channel_info_t
 Channel information structure for fluid_synth_get_channel_info(). More...

Defines

#define FLUID_SYNTH_CHANNEL_INFO_NAME_SIZE   32
 Length of channel info name field (including zero terminator).
#define FLUID_REVERB_DEFAULT_ROOMSIZE   0.2f
 Default reverb room size.
#define FLUID_REVERB_DEFAULT_DAMP   0.0f
 Default reverb damping.
#define FLUID_REVERB_DEFAULT_WIDTH   0.5f
 Default reverb width.
#define FLUID_REVERB_DEFAULT_LEVEL   0.9f
 Default reverb level.
#define FLUID_CHORUS_DEFAULT_N   3
 Default chorus voice count.
#define FLUID_CHORUS_DEFAULT_LEVEL   2.0f
 Default chorus level.
#define FLUID_CHORUS_DEFAULT_SPEED   0.3f
 Default chorus speed.
#define FLUID_CHORUS_DEFAULT_DEPTH   8.0f
 Default chorus depth.
#define FLUID_CHORUS_DEFAULT_TYPE   FLUID_CHORUS_MOD_SINE
 Default chorus waveform type.
#define FLUID_INTERP_DEFAULT   FLUID_INTERP_4THORDER
 Default interpolation method from fluid_interp.
#define FLUID_INTERP_HIGHEST   FLUID_INTERP_7THORDER
 Highest interpolation method from fluid_interp.

Typedefs

typedef int(* fluid_audio_callback_t )(fluid_synth_t *synth, int len, void *out1, int loff, int lincr, void *out2, int roff, int rincr)
 Type definition of the synthesizer's audio callback function.

Enumerations

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 }
 

Synthesis interpolation method.

More...

Functions

FLUIDSYNTH_API fluid_synth_tnew_fluid_synth (fluid_settings_t *settings)
 Create new FluidSynth instance.
FLUIDSYNTH_API int delete_fluid_synth (fluid_synth_t *synth)
 Delete a FluidSynth instance.
FLUIDSYNTH_API fluid_settings_tfluid_synth_get_settings (fluid_synth_t *synth)
 Get settings assigned to a synth.
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.
FLUIDSYNTH_API int fluid_synth_noteoff (fluid_synth_t *synth, int chan, int key)
 Send a note-off event to a FluidSynth object.
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.
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.
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.
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.
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.
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.
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.
FLUIDSYNTH_API int fluid_synth_program_change (fluid_synth_t *synth, int chan, int program)
 Send a program change event on a MIDI channel.
FLUIDSYNTH_API int fluid_synth_channel_pressure (fluid_synth_t *synth, int chan, int val)
 Set the MIDI channel pressure controller value.
FLUIDSYNTH_API int fluid_synth_bank_select (fluid_synth_t *synth, int chan, unsigned int bank)
 Set instrument bank number on a MIDI channel.
FLUIDSYNTH_API int fluid_synth_sfont_select (fluid_synth_t *synth, int chan, unsigned int sfont_id)
 Set SoundFont ID on a MIDI channel.
FLUIDSYNTH_API int fluid_synth_program_select (fluid_synth_t *synth, int chan, unsigned int sfont_id, unsigned int bank_num, unsigned int preset_num)
 Select an instrument on a MIDI channel by SoundFont ID, bank and program numbers.
FLUIDSYNTH_API int fluid_synth_program_select_by_sfont_name (fluid_synth_t *synth, int chan, const char *sfont_name, unsigned int bank_num, unsigned int preset_num)
 Select an instrument on a MIDI channel by SoundFont name, bank and program numbers.
FLUIDSYNTH_API int fluid_synth_get_program (fluid_synth_t *synth, int chan, unsigned int *sfont_id, unsigned int *bank_num, unsigned int *preset_num)
 Get current SoundFont ID, bank number and program number for a MIDI channel.
FLUIDSYNTH_API int fluid_synth_unset_program (fluid_synth_t *synth, int chan)
 Set the preset of a MIDI channel to an unassigned state.
FLUIDSYNTH_API int fluid_synth_get_channel_info (fluid_synth_t *synth, int chan, fluid_synth_channel_info_t *info)
 Get information on the currently selected preset on a MIDI channel.
FLUIDSYNTH_API int fluid_synth_program_reset (fluid_synth_t *synth)
 Resend a bank select and a program change for every channel.
FLUIDSYNTH_API int fluid_synth_system_reset (fluid_synth_t *synth)
 Send MIDI system reset command (big red 'panic' button), turns off notes and resets controllers.
FLUIDSYNTH_API fluid_preset_tfluid_synth_get_channel_preset (fluid_synth_t *synth, int chan)
 Get active preset on a MIDI channel.
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.
FLUIDSYNTH_API int fluid_synth_stop (fluid_synth_t *synth, unsigned int id)
 Stop notes for a given note event voice ID.
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).
FLUIDSYNTH_API int fluid_synth_sfreload (fluid_synth_t *synth, unsigned int id)
 Reload a SoundFont.
FLUIDSYNTH_API int fluid_synth_sfunload (fluid_synth_t *synth, unsigned int id, int reset_presets)
 Unload a SoundFont.
FLUIDSYNTH_API int fluid_synth_add_sfont (fluid_synth_t *synth, fluid_sfont_t *sfont)
 Add a SoundFont.
FLUIDSYNTH_API void fluid_synth_remove_sfont (fluid_synth_t *synth, fluid_sfont_t *sfont)
 Remove a SoundFont from the SoundFont stack without deleting it.
FLUIDSYNTH_API int fluid_synth_sfcount (fluid_synth_t *synth)
 Count number of loaded SoundFont files.
FLUIDSYNTH_API fluid_sfont_tfluid_synth_get_sfont (fluid_synth_t *synth, unsigned int num)
 Get SoundFont by index.
FLUIDSYNTH_API fluid_sfont_tfluid_synth_get_sfont_by_id (fluid_synth_t *synth, unsigned int id)
 Get SoundFont by ID.
FLUIDSYNTH_API fluid_sfont_tfluid_synth_get_sfont_by_name (fluid_synth_t *synth, const char *name)
 Get SoundFont by name.
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.
FLUIDSYNTH_API int fluid_synth_get_bank_offset (fluid_synth_t *synth, int sfont_id)
 Get bank offset of a loaded SoundFont.
FLUIDSYNTH_API void fluid_synth_set_reverb (fluid_synth_t *synth, double roomsize, double damping, double width, double level)
 Set reverb parameters.
FLUIDSYNTH_API void fluid_synth_set_reverb_on (fluid_synth_t *synth, int on)
 Enable or disable reverb effect.
FLUIDSYNTH_API double fluid_synth_get_reverb_roomsize (fluid_synth_t *synth)
 Get reverb room size.
FLUIDSYNTH_API double fluid_synth_get_reverb_damp (fluid_synth_t *synth)
 Get reverb damping.
FLUIDSYNTH_API double fluid_synth_get_reverb_level (fluid_synth_t *synth)
 Get reverb level.
FLUIDSYNTH_API double fluid_synth_get_reverb_width (fluid_synth_t *synth)
 Get reverb width.
FLUIDSYNTH_API void fluid_synth_set_chorus (fluid_synth_t *synth, int nr, double level, double speed, double depth_ms, int type)
 Set chorus parameters.
FLUIDSYNTH_API void fluid_synth_set_chorus_on (fluid_synth_t *synth, int on)
 Enable or disable chorus effect.
FLUIDSYNTH_API int fluid_synth_get_chorus_nr (fluid_synth_t *synth)
 Get chorus voice number (delay line count) value.
FLUIDSYNTH_API double fluid_synth_get_chorus_level (fluid_synth_t *synth)
 Get chorus level.
FLUIDSYNTH_API double fluid_synth_get_chorus_speed_Hz (fluid_synth_t *synth)
 Get chorus speed in Hz.
FLUIDSYNTH_API double fluid_synth_get_chorus_depth_ms (fluid_synth_t *synth)
 Get chorus depth.
FLUIDSYNTH_API int fluid_synth_get_chorus_type (fluid_synth_t *synth)
 Get chorus waveform type.
FLUIDSYNTH_API int fluid_synth_count_midi_channels (fluid_synth_t *synth)
 Get the total count of MIDI channels.
FLUIDSYNTH_API int fluid_synth_count_audio_channels (fluid_synth_t *synth)
 Get the total count of audio channels.
FLUIDSYNTH_API int fluid_synth_count_audio_groups (fluid_synth_t *synth)
 Get the total number of allocated audio channels.
FLUIDSYNTH_API int fluid_synth_count_effects_channels (fluid_synth_t *synth)
 Get the total number of allocated effects channels.
FLUIDSYNTH_API void fluid_synth_set_gain (fluid_synth_t *synth, float gain)
 Set synth output gain value.
FLUIDSYNTH_API float fluid_synth_get_gain (fluid_synth_t *synth)
 Get synth output gain value.
FLUIDSYNTH_API int fluid_synth_set_polyphony (fluid_synth_t *synth, int polyphony)
 Set synthesizer polyphony (max number of voices).
FLUIDSYNTH_API int fluid_synth_get_polyphony (fluid_synth_t *synth)
 Get current synthesizer polyphony (max number of voices).
FLUIDSYNTH_API int fluid_synth_get_active_voice_count (fluid_synth_t *synth)
 Get current number of active voices.
FLUIDSYNTH_API int fluid_synth_get_internal_bufsize (fluid_synth_t *synth)
 Get the internal synthesis buffer size value.
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.
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.
FLUIDSYNTH_API int fluid_synth_set_gen2 (fluid_synth_t *synth, int chan, int param, float value, int absolute, int normalized)
 Set a SoundFont generator (effect) value on a MIDI channel in real-time.
FLUIDSYNTH_API float fluid_synth_get_gen (fluid_synth_t *synth, int chan, int param)
 Get generator value assigned to a MIDI channel.
FLUIDSYNTH_API int fluid_synth_create_key_tuning (fluid_synth_t *synth, int bank, int prog, const char *name, const double *pitch)
 Set the tuning of the entire MIDI note scale.
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.
FLUIDSYNTH_API int fluid_synth_create_octave_tuning (fluid_synth_t *synth, int bank, int prog, const char *name, const double *pitch)
 Apply an octave tuning to every octave in the MIDI note scale.
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.
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.
FLUIDSYNTH_API int fluid_synth_select_tuning (fluid_synth_t *synth, int chan, int bank, int prog)
 Select a tuning scale on a MIDI channel.
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.
FLUIDSYNTH_API int fluid_synth_reset_tuning (fluid_synth_t *synth, int chan)
 Clear tuning scale on a MIDI channel (set it to the default well-tempered scale).
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).
FLUIDSYNTH_API void fluid_synth_tuning_iteration_start (fluid_synth_t *synth)
 Start tuning iteration.
FLUIDSYNTH_API int fluid_synth_tuning_iteration_next (fluid_synth_t *synth, int *bank, int *prog)
 Advance to next tuning.
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.
FLUIDSYNTH_API double fluid_synth_get_cpu_load (fluid_synth_t *synth)
 Get the synth CPU load value.
FLUIDSYNTH_API char * fluid_synth_error (fluid_synth_t *synth)
 Get a textual representation of the last error.
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.
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.
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 audio buffers.
FLUIDSYNTH_API int fluid_synth_process (fluid_synth_t *synth, int len, int nin, float **in, int nout, float **out)
 Synthesize floating point audio to audio buffers.
FLUIDSYNTH_API void fluid_synth_add_sfloader (fluid_synth_t *synth, fluid_sfloader_t *loader)
 Add a SoundFont loader interface.
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.
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().
FLUIDSYNTH_API void fluid_synth_get_voicelist (fluid_synth_t *synth, fluid_voice_t *buf[], int bufsize, int ID)
 Get list of voices.
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.
FLUIDSYNTH_API void fluid_synth_set_midi_router (fluid_synth_t *synth, fluid_midi_router_t *router)
 Assign a MIDI router to a synth.

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(), ...


Define Documentation

#define FLUID_INTERP_DEFAULT   FLUID_INTERP_4THORDER

Default interpolation method from fluid_interp.

#define FLUID_INTERP_HIGHEST   FLUID_INTERP_7THORDER

Highest interpolation method from fluid_interp.


Typedef Documentation

typedef int(* fluid_audio_callback_t)(fluid_synth_t *synth, int len, void *out1, int loff, int lincr, void *out2, int roff, int rincr)

Type definition of the synthesizer's audio callback function.

Parameters:
synth FluidSynth instance
Parameters:
len Count of audio frames to synthesize
Parameters:
out1 Array to store left channel of audio to
Parameters:
loff Offset index in 'out1' for first sample
Parameters:
lincr Increment between samples stored to 'out1'
Parameters:
out2 Array to store right channel of audio to
Parameters:
roff Offset index in 'out2' for first sample
Parameters:
rincr Increment between samples stored to 'out2'

Enumeration Type Documentation

Chorus modulation waveform type.

Enumerator:
FLUID_CHORUS_MOD_SINE 

Sine wave chorus modulation.

FLUID_CHORUS_MOD_TRIANGLE 

Triangle wave chorus modulation.

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.


Function Documentation

FLUIDSYNTH_API fluid_synth_t* new_fluid_synth ( fluid_settings_t settings  ) 

Create new FluidSynth instance.

Parameters:
settings Configuration parameters to use (used directly).
Returns:
New FluidSynth instance or NULL on error
NOTE: The settings parameter is used directly and should not be modified or freed independently.
Examples:
example.c, fluidsynth_arpeggio.c, fluidsynth_fx.c, fluidsynth_metronome.c, and fluidsynth_simple.c.
FLUIDSYNTH_API int delete_fluid_synth ( fluid_synth_t synth  ) 

Delete a FluidSynth instance.

Parameters:
synth FluidSynth instance to delete
Returns:
FLUID_OK
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, and fluidsynth_simple.c.
FLUIDSYNTH_API fluid_settings_t* fluid_synth_get_settings ( fluid_synth_t synth  ) 

Get settings assigned to a synth.

Parameters:
synth FluidSynth instance
Returns:
FluidSynth settings which are assigned to the synth
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:
synth FluidSynth instance
Parameters:
chan MIDI channel number (0 to MIDI channel count - 1)
Parameters:
key MIDI note number (0-127)
Parameters:
vel MIDI velocity (0-127, 0=noteoff)
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
Examples:
example.c, fluidsynth_fx.c, and fluidsynth_simple.c.
FLUIDSYNTH_API int fluid_synth_noteoff ( fluid_synth_t synth,
int  chan,
int  key 
)

Send a note-off event to a FluidSynth object.

Parameters:
synth FluidSynth instance
Parameters:
chan MIDI channel number (0 to MIDI channel count - 1)
Parameters:
key MIDI 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.
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:
synth FluidSynth instance
Parameters:
chan MIDI channel number (0 to MIDI channel count - 1)
Parameters:
num MIDI controller number (0-127)
Parameters:
val MIDI controller value (0-127)
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
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:
synth FluidSynth instance
Parameters:
chan MIDI channel number (0 to MIDI channel count - 1)
Parameters:
num MIDI controller number (0-127)
Parameters:
pval Location to store MIDI controller value (0-127)
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
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:
synth FluidSynth instance
Parameters:
data Buffer containing SYSEX data (not including 0xF0 and 0xF7)
Parameters:
len Length of data in buffer
Parameters:
response Buffer to store response to or NULL to ignore
Parameters:
response_len IN/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)
Parameters:
handled Optional location to store boolean value if message was recognized and handled or not (set to TRUE if it was handled)
Parameters:
dryrun TRUE 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
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:
synth FluidSynth instance
Parameters:
chan MIDI channel number (0 to MIDI channel count - 1)
Parameters:
val MIDI pitch bend value (0-16383 with 8192 being center)
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
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:
synth FluidSynth instance
Parameters:
chan MIDI channel number (0 to MIDI channel count - 1)
Parameters:
ppitch_bend Location to store MIDI pitch bend value (0-16383 with 8192 being center)
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
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:
synth FluidSynth instance
Parameters:
chan MIDI channel number (0 to MIDI channel count - 1)
Parameters:
val Pitch wheel sensitivity value in semitones
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
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:
synth FluidSynth instance
Parameters:
chan MIDI channel number (0 to MIDI channel count - 1)
Parameters:
pval Location to store pitch wheel sensitivity value in semitones
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
Since:
Sometime AFTER v1.0 API freeze.
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:
synth FluidSynth instance
Parameters:
chan MIDI channel number (0 to MIDI channel count - 1)
Parameters:
prognum MIDI program number (0-127)
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
FLUIDSYNTH_API int fluid_synth_channel_pressure ( fluid_synth_t synth,
int  chan,
int  val 
)

Set the MIDI channel pressure controller value.

Parameters:
synth FluidSynth instance
Parameters:
chan MIDI channel number (0 to MIDI channel count - 1)
Parameters:
val MIDI channel pressure value (0-127)
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
FLUIDSYNTH_API int fluid_synth_bank_select ( fluid_synth_t synth,
int  chan,
unsigned int  bank 
)

Set instrument bank number on a MIDI channel.

Parameters:
synth FluidSynth instance
Parameters:
chan MIDI channel number (0 to MIDI channel count - 1)
Parameters:
bank MIDI bank number
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
FLUIDSYNTH_API int fluid_synth_sfont_select ( fluid_synth_t synth,
int  chan,
unsigned int  sfont_id 
)

Set SoundFont ID on a MIDI channel.

Parameters:
synth FluidSynth instance
Parameters:
chan MIDI channel number (0 to MIDI channel count - 1)
Parameters:
sfont_id ID of a loaded SoundFont
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
FLUIDSYNTH_API int fluid_synth_program_select ( fluid_synth_t synth,
int  chan,
unsigned int  sfont_id,
unsigned int  bank_num,
unsigned int  preset_num 
)

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

Parameters:
synth FluidSynth instance
Parameters:
chan MIDI channel number (0 to MIDI channel count - 1)
Parameters:
sfont_id ID of a loaded SoundFont
Parameters:
bank_num MIDI bank number
Parameters:
preset_num MIDI program number
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
FLUIDSYNTH_API int fluid_synth_program_select_by_sfont_name ( fluid_synth_t synth,
int  chan,
const char *  sfont_name,
unsigned int  bank_num,
unsigned int  preset_num 
)

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

Parameters:
synth FluidSynth instance
Parameters:
chan MIDI channel number (0 to MIDI channel count - 1)
Parameters:
sfont_name Name of a loaded SoundFont
Parameters:
bank_num MIDI bank number
Parameters:
preset_num MIDI program number
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
Since:
1.1.0
FLUIDSYNTH_API int fluid_synth_get_program ( fluid_synth_t synth,
int  chan,
unsigned int *  sfont_id,
unsigned int *  bank_num,
unsigned int *  preset_num 
)

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

Parameters:
synth FluidSynth instance
Parameters:
chan MIDI channel number (0 to MIDI channel count - 1)
Parameters:
sfont_id Location to store SoundFont ID
Parameters:
bank_num Location to store MIDI bank number
Parameters:
preset_num Location to store MIDI program number
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
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:
synth FluidSynth instance
Parameters:
chan MIDI 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.
FLUIDSYNTH_API int fluid_synth_get_channel_info ( fluid_synth_t synth,
int  chan,
fluid_synth_channel_info_t info 
)

Get information on the currently selected preset on a MIDI channel.

Parameters:
synth FluidSynth instance
Parameters:
chan MIDI channel number (0 to MIDI channel count - 1)
Parameters:
info Caller supplied structure to fill with preset information
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
Since:
1.1.1
FLUIDSYNTH_API int fluid_synth_program_reset ( fluid_synth_t synth  ) 

Resend a bank select and a program change for every channel.

Parameters:
synth FluidSynth instance
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
This function is called mainly after a SoundFont has been loaded, unloaded or reloaded.
FLUIDSYNTH_API int fluid_synth_system_reset ( fluid_synth_t synth  ) 

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

Parameters:
synth FluidSynth instance
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
FLUIDSYNTH_API fluid_preset_t* fluid_synth_get_channel_preset ( fluid_synth_t synth,
int  chan 
)

Get active preset on a MIDI channel.

Parameters:
synth FluidSynth instance
Parameters:
chan MIDI channel number (0 to MIDI channel count - 1)
Returns:
Preset or NULL if no preset active on channel
Deprecated:
fluid_synth_get_channel_info() should replace most use cases.
NOTE: Should only be called from within synthesis thread, which includes SoundFont loader preset noteon methods. Not thread safe otherwise.
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.

Parameters:
synth FluidSynth instance
Parameters:
id Voice group ID to use (can be used with fluid_synth_stop()).
Parameters:
preset Preset to synthesize
Parameters:
audio_chan Unused currently, set to 0
Parameters:
midi_chan MIDI channel number (0 to MIDI channel count - 1)
Parameters:
key MIDI note number (0-127)
Parameters:
vel MIDI 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.
FLUIDSYNTH_API int fluid_synth_stop ( fluid_synth_t synth,
unsigned int  id 
)

Stop notes for a given note event voice ID.

Parameters:
synth FluidSynth instance
Parameters:
id Voice 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.
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:
synth SoundFont instance
Parameters:
filename File to load
Parameters:
reset_presets TRUE to re-assign presets for all MIDI channels
Returns:
SoundFont ID on success, FLUID_FAILED on error
Examples:
example.c, fluidsynth_arpeggio.c, fluidsynth_fx.c, fluidsynth_metronome.c, and fluidsynth_simple.c.
FLUIDSYNTH_API int fluid_synth_sfreload ( fluid_synth_t synth,
unsigned int  id 
)

Reload a SoundFont.

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

Parameters:
synth SoundFont instance
Parameters:
id ID of SoundFont to reload
Returns:
SoundFont ID on success, FLUID_FAILED on error
FLUIDSYNTH_API int fluid_synth_sfunload ( fluid_synth_t synth,
unsigned int  id,
int  reset_presets 
)

Unload a SoundFont.

Parameters:
synth SoundFont instance
Parameters:
id ID of SoundFont to unload
Parameters:
reset_presets TRUE to re-assign presets for all MIDI channels
Returns:
FLUID_OK on success, FLUID_FAILED on error
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:
synth FluidSynth instance
Parameters:
sfont SoundFont to add
Returns:
New assigned SoundFont ID or FLUID_FAILED on error
FLUIDSYNTH_API void fluid_synth_remove_sfont ( fluid_synth_t synth,
fluid_sfont_t sfont 
)

Remove a SoundFont from the SoundFont stack without deleting it.

Parameters:
synth FluidSynth instance
Parameters:
sfont SoundFont to remove
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.

FLUIDSYNTH_API int fluid_synth_sfcount ( fluid_synth_t synth  ) 

Count number of loaded SoundFont files.

Parameters:
synth FluidSynth instance
Returns:
Count of loaded SoundFont files.
FLUIDSYNTH_API fluid_sfont_t* fluid_synth_get_sfont ( fluid_synth_t synth,
unsigned int  num 
)

Get SoundFont by index.

Parameters:
synth FluidSynth instance
Parameters:
num SoundFont 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.
FLUIDSYNTH_API fluid_sfont_t* fluid_synth_get_sfont_by_id ( fluid_synth_t synth,
unsigned int  id 
)

Get SoundFont by ID.

Parameters:
synth FluidSynth instance
Parameters:
id SoundFont 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.
FLUIDSYNTH_API fluid_sfont_t* fluid_synth_get_sfont_by_name ( fluid_synth_t synth,
const char *  name 
)

Get SoundFont by name.

Parameters:
synth FluidSynth instance
Parameters:
name Name 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.
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.

Parameters:
synth FluidSynth instance
Parameters:
sfont_id ID of a loaded SoundFont
Parameters:
offset Bank offset value to apply to all instruments
FLUIDSYNTH_API int fluid_synth_get_bank_offset ( fluid_synth_t synth,
int  sfont_id 
)

Get bank offset of a loaded SoundFont.

Parameters:
synth FluidSynth instance
Parameters:
sfont_id ID of a loaded SoundFont
Returns:
SoundFont bank offset value
FLUIDSYNTH_API void fluid_synth_set_reverb ( fluid_synth_t synth,
double  roomsize,
double  damping,
double  width,
double  level 
)

Set reverb parameters.

Parameters:
synth FluidSynth instance
Parameters:
roomsize Reverb room size value (0.0-1.2)
Parameters:
damping Reverb damping value (0.0-1.0)
Parameters:
width Reverb width value (0.0-100.0)
Parameters:
level Reverb level value (0.0-1.0)
NOTE: Not realtime safe and therefore should not be called from synthesis context at the risk of stalling audio output.
FLUIDSYNTH_API void fluid_synth_set_reverb_on ( fluid_synth_t synth,
int  on 
)

Enable or disable reverb effect.

Parameters:
synth FluidSynth instance
Parameters:
on TRUE to enable reverb, FALSE to disable
FLUIDSYNTH_API double fluid_synth_get_reverb_roomsize ( fluid_synth_t synth  ) 

Get reverb room size.

Parameters:
synth FluidSynth instance
Returns:
Reverb room size (0.0-1.2)
FLUIDSYNTH_API double fluid_synth_get_reverb_damp ( fluid_synth_t synth  ) 

Get reverb damping.

Parameters:
synth FluidSynth instance
Returns:
Reverb damping value (0.0-1.0)
FLUIDSYNTH_API double fluid_synth_get_reverb_level ( fluid_synth_t synth  ) 

Get reverb level.

Parameters:
synth FluidSynth instance
Returns:
Reverb level value (0.0-1.0)
FLUIDSYNTH_API double fluid_synth_get_reverb_width ( fluid_synth_t synth  ) 

Get reverb width.

Parameters:
synth FluidSynth instance
Returns:
Reverb width value (0.0-100.0)
FLUIDSYNTH_API void fluid_synth_set_chorus ( fluid_synth_t synth,
int  nr,
double  level,
double  speed,
double  depth_ms,
int  type 
)

Set chorus parameters.

Parameters:
synth FluidSynth instance
Parameters:
nr Chorus voice count (0-99, CPU time consumption proportional to this value)
Parameters:
level Chorus level (0.0-1.0)
Parameters:
speed Chorus speed in Hz (0.29-5.0)
Parameters:
depth_ms Chorus depth (max value depends on synth sample rate, 0.0-21.0 is safe for sample rate values up to 96KHz)
Parameters:
type Chorus waveform type (fluid_chorus_mod)
NOTE: Not realtime safe and therefore should not be called from synthesis context at the risk of stalling audio output.
FLUIDSYNTH_API void fluid_synth_set_chorus_on ( fluid_synth_t synth,
int  on 
)

Enable or disable chorus effect.

Parameters:
synth FluidSynth instance
Parameters:
on TRUE to enable chorus, FALSE to disable
FLUIDSYNTH_API int fluid_synth_get_chorus_nr ( fluid_synth_t synth  ) 

Get chorus voice number (delay line count) value.

Parameters:
synth FluidSynth instance
Returns:
Chorus voice count (0-99)
FLUIDSYNTH_API double fluid_synth_get_chorus_level ( fluid_synth_t synth  ) 

Get chorus level.

Parameters:
synth FluidSynth instance
Returns:
Chorus level value (0.0-10.0)
FLUIDSYNTH_API double fluid_synth_get_chorus_speed_Hz ( fluid_synth_t synth  ) 

Get chorus speed in Hz.

Parameters:
synth FluidSynth instance
Returns:
Chorus speed in Hz (0.29-5.0)
FLUIDSYNTH_API double fluid_synth_get_chorus_depth_ms ( fluid_synth_t synth  ) 

Get chorus depth.

Parameters:
synth FluidSynth instance
Returns:
Chorus depth
FLUIDSYNTH_API int fluid_synth_get_chorus_type ( fluid_synth_t synth  ) 

Get chorus waveform type.

Parameters:
synth FluidSynth instance
Returns:
Chorus waveform type (fluid_chorus_mod)
FLUIDSYNTH_API int fluid_synth_count_midi_channels ( fluid_synth_t synth  ) 

Get the total count of MIDI channels.

Parameters:
synth FluidSynth instance
Returns:
Count of MIDI channels
FLUIDSYNTH_API int fluid_synth_count_audio_channels ( fluid_synth_t synth  ) 

Get the total count of audio channels.

Parameters:
synth FluidSynth instance
Returns:
Count of audio channel stereo pairs (1 = 2 channels, 2 = 4, etc)
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:
synth FluidSynth instance
Returns:
Count of audio group stereo pairs (1 = 2 channels, 2 = 4, etc)
FLUIDSYNTH_API int fluid_synth_count_effects_channels ( fluid_synth_t synth  ) 

Get the total number of allocated effects channels.

Parameters:
synth FluidSynth instance
Returns:
Count of allocated effects channels
FLUIDSYNTH_API void fluid_synth_set_gain ( fluid_synth_t synth,
float  gain 
)

Set synth output gain value.

Parameters:
synth FluidSynth instance
Parameters:
gain Gain value (function clamps value to the range 0.0 to 10.0)
FLUIDSYNTH_API float fluid_synth_get_gain ( fluid_synth_t synth  ) 

Get synth output gain value.

Parameters:
synth FluidSynth instance
Returns:
Synth gain value (0.0 to 10.0)
FLUIDSYNTH_API int fluid_synth_set_polyphony ( fluid_synth_t synth,
int  polyphony 
)

Set synthesizer polyphony (max number of voices).

Parameters:
synth FluidSynth instance
Parameters:
polyphony Polyphony to assign
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
Since:
1.0.6
FLUIDSYNTH_API int fluid_synth_get_polyphony ( fluid_synth_t synth  ) 

Get current synthesizer polyphony (max number of voices).

Parameters:
synth FluidSynth instance
Returns:
Synth polyphony value.
Since:
1.0.6
FLUIDSYNTH_API int fluid_synth_get_active_voice_count ( fluid_synth_t synth  ) 

Get current number of active voices.

Parameters:
synth FluidSynth 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.
FLUIDSYNTH_API int fluid_synth_get_internal_bufsize ( fluid_synth_t synth  ) 

Get the internal synthesis buffer size value.

Parameters:
synth FluidSynth instance
Returns:
Internal buffer size in audio frames.
Audio is synthesized this number of frames at a time. Defaults to 64 frames.
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:
synth FluidSynth instance
Parameters:
chan MIDI channel to set interpolation method on or -1 for all channels
Parameters:
interp_method Interpolation method (fluid_interp)
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
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:
synth FluidSynth instance
Parameters:
chan MIDI channel number (0 to MIDI channel count - 1)
Parameters:
param SoundFont generator ID (fluid_gen_type)
Parameters:
value Offset generator value to assign to the MIDI channel
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
Parameter numbers and ranges are described in the SoundFont 2.01 specification PDF, paragraph 8.1.3, page 48. See fluid_gen_type.
FLUIDSYNTH_API int fluid_synth_set_gen2 ( fluid_synth_t synth,
int  chan,
int  param,
float  value,
int  absolute,
int  normalized 
)

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

Parameters:
synth FluidSynth instance
Parameters:
chan MIDI channel number (0 to MIDI channel count - 1)
Parameters:
param SoundFont generator ID (fluid_gen_type)
Parameters:
value Offset or absolute generator value to assign to the MIDI channel
Parameters:
absolute 0 to assign a relative value, non-zero to assign an absolute value
Parameters:
normalized 0 if value is specified in the native units of the generator, non-zero to take the value as a 0.0-1.0 range and apply it to the valid generator effect range (scaled and shifted as necessary).
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
Since:
1.1.0
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.
FLUIDSYNTH_API float fluid_synth_get_gen ( fluid_synth_t synth,
int  chan,
int  param 
)

Get generator value assigned to a MIDI channel.

Parameters:
synth FluidSynth instance
Parameters:
chan MIDI channel number (0 to MIDI channel count - 1)
Parameters:
param SoundFont generator ID (fluid_gen_type)
Returns:
Current generator value assigned to MIDI channel
FLUIDSYNTH_API int fluid_synth_create_key_tuning ( fluid_synth_t synth,
int  bank,
int  prog,
const char *  name,
const double *  pitch 
)

Set the tuning of the entire MIDI note scale.

Parameters:
synth FluidSynth instance
Parameters:
bank Tuning bank number (0-127), not related to MIDI instrument bank
Parameters:
prog Tuning preset number (0-127), not related to MIDI instrument program
Parameters:
name Label name for this tuning
Parameters:
pitch Array 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 well-tempered (normal) scale.
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
NOTE: Tuning is not applied in realtime to existing notes of the replaced tuning (if any), use fluid_synth_activate_key_tuning() instead to specify this behavior.
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:
synth FluidSynth instance
Parameters:
bank Tuning bank number (0-127), not related to MIDI instrument bank
Parameters:
prog Tuning preset number (0-127), not related to MIDI instrument program
Parameters:
name Label name for this tuning
Parameters:
pitch Array 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 well-tempered (normal) scale.
Parameters:
apply TRUE 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
FLUIDSYNTH_API int fluid_synth_create_octave_tuning ( fluid_synth_t synth,
int  bank,
int  prog,
const char *  name,
const double *  pitch 
)

Apply an octave tuning to every octave in the MIDI note scale.

Parameters:
synth FluidSynth instance
Parameters:
bank Tuning bank number (0-127), not related to MIDI instrument bank
Parameters:
prog Tuning preset number (0-127), not related to MIDI instrument program
Parameters:
name Label name for this tuning
Parameters:
pitch Array 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)
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
NOTE: Tuning is not applied in realtime to existing notes of the replaced tuning (if any), use fluid_synth_activate_octave_tuning() instead to specify this behavior.
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:
synth FluidSynth instance
Parameters:
bank Tuning bank number (0-127), not related to MIDI instrument bank
Parameters:
prog Tuning preset number (0-127), not related to MIDI instrument program
Parameters:
name Label name for this tuning
Parameters:
pitch Array 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)
Parameters:
apply TRUE 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
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:
synth FluidSynth instance
Parameters:
bank Tuning bank number (0-127), not related to MIDI instrument bank
Parameters:
prog Tuning preset number (0-127), not related to MIDI instrument program
Parameters:
len Number of MIDI notes to assign
Parameters:
key Array of MIDI key numbers (length of 'len', values 0-127)
Parameters:
pitch Array of pitch values (length of 'len', values are number of cents from MIDI note 0)
Parameters:
apply TRUE 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.
FLUIDSYNTH_API int fluid_synth_select_tuning ( fluid_synth_t synth,
int  chan,
int  bank,
int  prog 
)

Select a tuning scale on a MIDI channel.

Parameters:
synth FluidSynth instance
Parameters:
chan MIDI channel number (0 to MIDI channel count - 1)
Parameters:
bank Tuning bank number (0-127), not related to MIDI instrument bank
Parameters:
prog Tuning preset number (0-127), not related to MIDI instrument program
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
NOTE: This function does NOT activate tuning in realtime, use fluid_synth_activate_tuning() instead to specify whether tuning change should cause existing notes to update.
NOTE: Prior to version 1.1.0 it was an error to select a tuning that didn't already exist. Starting with 1.1.0, a default equal tempered scale will be created, if no tuning exists for the given bank and prog.
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:
synth FluidSynth instance
Parameters:
chan MIDI channel number (0 to MIDI channel count - 1)
Parameters:
bank Tuning bank number (0-127), not related to MIDI instrument bank
Parameters:
prog Tuning preset number (0-127), not related to MIDI instrument program
Parameters:
apply TRUE 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.
FLUIDSYNTH_API int fluid_synth_reset_tuning ( fluid_synth_t synth,
int  chan 
)

Clear tuning scale on a MIDI channel (set it to the default well-tempered scale).

Parameters:
synth FluidSynth instance
Parameters:
chan MIDI channel number (0 to MIDI channel count - 1)
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
NOTE: This function does NOT activate tuning change in realtime, use fluid_synth_deactivate_tuning() instead to specify whether tuning change should cause existing notes to update.
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:
synth FluidSynth instance
Parameters:
chan MIDI channel number (0 to MIDI channel count - 1)
Parameters:
apply TRUE to apply tuning change to active notes, FALSE otherwise
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
Since:
1.1.0
FLUIDSYNTH_API void fluid_synth_tuning_iteration_start ( fluid_synth_t synth  ) 

Start tuning iteration.

Parameters:
synth FluidSynth instance
FLUIDSYNTH_API int fluid_synth_tuning_iteration_next ( fluid_synth_t synth,
int *  bank,
int *  prog 
)

Advance to next tuning.

Parameters:
synth FluidSynth instance
Parameters:
bank Location to store MIDI bank number of next tuning scale
Parameters:
prog Location to store MIDI program number of next tuning scale
Returns:
1 if tuning iteration advanced, 0 if no more tunings
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:
synth FluidSynth instance
Parameters:
bank MIDI bank number of tuning
Parameters:
prog MIDI program number of tuning
Parameters:
name Location to store tuning name or NULL to ignore
Parameters:
len Maximum number of chars to store to 'name' (including NULL byte)
Parameters:
pitch Array to store tuning scale to or NULL to ignore (len of 128)
Returns:
FLUID_OK if matching tuning was found, FLUID_FAILED otherwise
FLUIDSYNTH_API double fluid_synth_get_cpu_load ( fluid_synth_t synth  ) 

Get the synth CPU load value.

Parameters:
synth FluidSynth instance
Returns:
Estimated CPU load value in percent (0-100)
FLUIDSYNTH_API char* fluid_synth_error ( fluid_synth_t synth  ) 

Get a textual representation of the last error.

Parameters:
synth FluidSynth 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.
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:
synth FluidSynth instance
Parameters:
len Count of audio frames to synthesize
Parameters:
lout Array of 16 bit words to store left channel of audio
Parameters:
loff Offset index in 'lout' for first sample
Parameters:
lincr Increment between samples stored to 'lout'
Parameters:
rout Array of 16 bit words to store right channel of audio
Parameters:
roff Offset index in 'rout' for first sample
Parameters:
rincr Increment between samples stored to 'rout'
Returns:
FLUID_OK on success, FLUID_FAIL otherwise
Useful for storing interleaved stereo (lout = rout, loff = 0, roff = 1, lincr = 2, rincr = 2).
NOTE: Should only be called from synthesis thread. NOTE: Dithering is performed when converting from internal floating point to 16 bit audio.
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:
synth FluidSynth instance
Parameters:
len Count of audio frames to synthesize
Parameters:
lout Array of floats to store left channel of audio
Parameters:
loff Offset index in 'lout' for first sample
Parameters:
lincr Increment between samples stored to 'lout'
Parameters:
rout Array of floats to store right channel of audio
Parameters:
roff Offset index in 'rout' for first sample
Parameters:
rincr Increment between samples stored to 'rout'
Returns:
FLUID_OK on success, FLUID_FAIL otherwise
Useful for storing interleaved stereo (lout = rout, loff = 0, roff = 1, lincr = 2, rincr = 2).
NOTE: Should only be called from synthesis thread.
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 audio buffers.

Parameters:
synth FluidSynth instance
Parameters:
len Count of audio frames to synthesize
Parameters:
left Array of floats to store left channel of audio (len in size)
Parameters:
right Array of floats to store right channel of audio (len in size)
Parameters:
fx_left Not currently used
Parameters:
fx_right Not currently used
Returns:
FLUID_OK on success, FLUID_FAIL otherwise
NOTE: Should only be called from synthesis thread.
FLUIDSYNTH_API int fluid_synth_process ( fluid_synth_t synth,
int  len,
int  nin,
float **  in,
int  nout,
float **  out 
)

Synthesize floating point audio to audio buffers.

Parameters:
synth FluidSynth instance
Parameters:
len Count of audio frames to synthesize
Parameters:
nin Ignored
Parameters:
in Ignored
Parameters:
nout Count of arrays in 'out'
Parameters:
out Array of arrays to store audio to
Returns:
FLUID_OK on success, FLUID_FAIL otherwise
This function implements the default interface defined in fluidsynth/audio.h. NOTE: Should only be called from synthesis thread.
Examples:
fluidsynth_fx.c.
FLUIDSYNTH_API void fluid_synth_add_sfloader ( fluid_synth_t synth,
fluid_sfloader_t loader 
)

Add a SoundFont loader interface.

Parameters:
synth FluidSynth instance
Parameters:
loader Loader API structure, used directly and should remain allocated as long as the synth instance is used.
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.

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:
synth FluidSynth instance
Parameters:
sample Sample to assign to the voice
Parameters:
chan MIDI channel number (0 to MIDI channel count - 1)
Parameters:
key MIDI note number for the voice (0-127)
Parameters:
vel MIDI 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.
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:
synth FluidSynth instance
Parameters:
voice Voice 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.

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

Get list of voices.

Parameters:
synth FluidSynth instance
Parameters:
buf Array to store voices to (NULL terminated if not filled completely)
Parameters:
bufsize Count of indexes in buf
Parameters:
id Voice 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.
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.

Parameters:
data FluidSynth instance
Parameters:
event MIDI event to handle
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
FLUIDSYNTH_API void fluid_synth_set_midi_router ( fluid_synth_t synth,
fluid_midi_router_t router 
)

Assign a MIDI router to a synth.

Parameters:
synth FluidSynth instance
Parameters:
router MIDI router to assign to the synth
NOTE: This should only be done once and prior to using the synth.
Generated on Tue Sep 27 17:10:33 2011 for libfluidsynth by  doxygen 1.6.3