class documentation

Synth represents a FluidSynth synthesizer

Method __init__ Create new synthesizer object to control sound generation
Method all_notes_off Turn off all notes on a channel (release all keys)
Method all_sounds_off Turn off all sounds on a channel (equivalent to mute)
Method bank_select Choose a bank
Method cc Send control change value
Method channel_info get soundfont, bank, prog, preset name of channel
Method delete Undocumented
Method get_cc Undocumented
Method get_chorus_depth Undocumented
Method get_chorus_level Undocumented
Method get_chorus_nr Undocumented
Method get_chorus_speed Undocumented
Method get_chorus_type Undocumented
Method get_reverb_damp Undocumented
Method get_reverb_level Undocumented
Method get_reverb_roomsize Undocumented
Method get_reverb_width Undocumented
Method get_samples Generate audio samples
Method get_setting get current value of an arbitrary synth setting
Method midi2audio Convert a midi file to an audio file
Method midi_event_get_channel Undocumented
Method midi_event_get_control Undocumented
Method midi_event_get_key Undocumented
Method midi_event_get_program Undocumented
Method midi_event_get_type Undocumented
Method midi_event_get_value Undocumented
Method midi_event_get_velocity Undocumented
Method noteoff Stop a note
Method noteon Play a note
Method pitch_bend Adjust pitch of a playing channel by small amounts
Method play_midi_file Undocumented
Method play_midi_stop Undocumented
Method player_set_tempo Undocumented
Method program_change Change the program
Method program_info get active soundfont, bank, prog on a channel
Method program_reset Reset the programs on all channels
Method program_select Select a program
Method program_unset Set the preset of a MIDI channel to an unassigned state
Method router_begin types are [note|cc|prog|pbend|cpress|kpress]
Method router_chan Undocumented
Method router_clear Undocumented
Method router_default Undocumented
Method router_end Undocumented
Method router_par1 Undocumented
Method router_par2 Undocumented
Method set_chorus nr Chorus voice count (0-99, CPU time consumption proportional to this value) level Chorus level (0.0-10.0) speed Chorus speed in Hz (0.29-5.0) depth_ms Chorus depth (max value depends on synth sample rate, 0...
Method set_chorus_depth Undocumented
Method set_chorus_level Undocumented
Method set_chorus_nr Undocumented
Method set_chorus_speed Undocumented
Method set_chorus_type Undocumented
Method set_reverb roomsize Reverb room size value (0.0-1.0) damping Reverb damping value (0.0-1.0) width Reverb width value (0.0-100.0) level Reverb level value (0.0-1.0)
Method set_reverb_damp Undocumented
Method set_reverb_level Undocumented
Method set_reverb_roomsize Undocumented
Method set_reverb_width Undocumented
Method setting change an arbitrary synth setting, type-smart
Method sfload Load SoundFont and return its ID
Method sfont_select Choose a SoundFont
Method sfpreset_name Return name of a soundfont preset
Method sfunload Unload a SoundFont and free memory it used
Method start Start audio output driver in separate background thread
Method system_reset Stop all notes and reset all programs
Method tuning_dump Get tuning information for given bank and preset
Instance Variable audio_driver Undocumented
Instance Variable custom_router_callback Undocumented
Instance Variable midi_driver Undocumented
Instance Variable player Undocumented
Instance Variable router Undocumented
Instance Variable settings Undocumented
Instance Variable synth Undocumented
def __init__(self, gain=0.2, samplerate=44100, channels=256, **kwargs): (source)

Create new synthesizer object to control sound generation

Optional keyword arguments: gain : scale factor for audio output, default is 0.2 lower values are quieter, allow more simultaneous notes samplerate : output samplerate in Hz, default is 44100 Hz added capability for passing arbitrary fluid settings using args

def all_notes_off(self, chan): (source)

Turn off all notes on a channel (release all keys)

def all_sounds_off(self, chan): (source)

Turn off all sounds on a channel (equivalent to mute)

def bank_select(self, chan, bank): (source)

Choose a bank

def cc(self, chan, ctrl, val): (source)

Send control change value

The controls that are recognized are dependent on the SoundFont. Values are always 0 to 127. Typical controls include:

1 : vibrato 7 : volume 10 : pan (left to right) 11 : expression (soft to loud) 64 : sustain 91 : reverb 93 : chorus
def channel_info(self, chan): (source)

get soundfont, bank, prog, preset name of channel

def delete(self): (source)

Undocumented

def get_cc(self, chan, num): (source)

Undocumented

def get_chorus_depth(self): (source)

Undocumented

def get_chorus_level(self): (source)

Undocumented

def get_chorus_nr(self): (source)

Undocumented

def get_chorus_speed(self): (source)

Undocumented

def get_chorus_type(self): (source)

Undocumented

def get_reverb_damp(self): (source)

Undocumented

def get_reverb_level(self): (source)

Undocumented

def get_reverb_roomsize(self): (source)

Undocumented

def get_reverb_width(self): (source)

Undocumented

def get_samples(self, len=1024): (source)

Generate audio samples

The return value will be a NumPy array containing the given length of audio samples. If the synth is set to stereo output (the default) the array will be size 2 * len.

def get_setting(self, opt): (source)

get current value of an arbitrary synth setting

def midi2audio(self, midifile, audiofile='output.wav'): (source)

Convert a midi file to an audio file

def midi_event_get_channel(self, event): (source)

Undocumented

def midi_event_get_control(self, event): (source)

Undocumented

def midi_event_get_key(self, event): (source)

Undocumented

def midi_event_get_program(self, event): (source)

Undocumented

def midi_event_get_type(self, event): (source)

Undocumented

def midi_event_get_value(self, event): (source)

Undocumented

def midi_event_get_velocity(self, event): (source)

Undocumented

def noteoff(self, chan, key): (source)

Stop a note

def noteon(self, chan, key, vel): (source)

Play a note

def pitch_bend(self, chan, val): (source)

Adjust pitch of a playing channel by small amounts

A pitch bend value of 0 is no pitch change from default. A value of -2048 is 1 semitone down. A value of 2048 is 1 semitone up. Maximum values are -8192 to +8191 (transposing by 4 semitones).

def play_midi_file(self, filename): (source)

Undocumented

def play_midi_stop(self): (source)

Undocumented

def player_set_tempo(self, tempo_type, tempo): (source)

Undocumented

def program_change(self, chan, prg): (source)

Change the program

def program_info(self, chan): (source)

get active soundfont, bank, prog on a channel

def program_reset(self): (source)

Reset the programs on all channels

def program_select(self, chan, sfid, bank, preset): (source)

Select a program

def program_unset(self, chan): (source)

Set the preset of a MIDI channel to an unassigned state

def router_begin(self, type): (source)

types are [note|cc|prog|pbend|cpress|kpress]

def router_chan(self, min, max, mul, add): (source)

Undocumented

def router_clear(self): (source)

Undocumented

def router_default(self): (source)

Undocumented

def router_end(self): (source)

Undocumented

def router_par1(self, min, max, mul, add): (source)

Undocumented

def router_par2(self, min, max, mul, add): (source)

Undocumented

def set_chorus(self, nr=-1, level=-1.0, speed=-1.0, depth=-1.0, type=-1): (source)

nr Chorus voice count (0-99, CPU time consumption proportional to this value) level Chorus level (0.0-10.0) speed Chorus speed in Hz (0.29-5.0) depth_ms Chorus depth (max value depends on synth sample rate, 0.0-21.0 is safe for sample rate values up to 96KHz) type Chorus waveform type (0=sine, 1=triangle)

def set_chorus_depth(self, depth_ms): (source)

Undocumented

def set_chorus_level(self, level): (source)

Undocumented

def set_chorus_nr(self, nr): (source)

Undocumented

def set_chorus_speed(self, speed): (source)

Undocumented

def set_chorus_type(self, type): (source)

Undocumented

def set_reverb(self, roomsize=-1.0, damping=-1.0, width=-1.0, level=-1.0): (source)

roomsize Reverb room size value (0.0-1.0) damping Reverb damping value (0.0-1.0) width Reverb width value (0.0-100.0) level Reverb level value (0.0-1.0)

def set_reverb_damp(self, damping): (source)

Undocumented

def set_reverb_level(self, level): (source)

Undocumented

def set_reverb_roomsize(self, roomsize): (source)

Undocumented

def set_reverb_width(self, width): (source)

Undocumented

def setting(self, opt, val): (source)

change an arbitrary synth setting, type-smart

def sfload(self, filename, update_midi_preset=0): (source)

Load SoundFont and return its ID

def sfont_select(self, chan, sfid): (source)

Choose a SoundFont

def sfpreset_name(self, sfid, bank, prenum): (source)

Return name of a soundfont preset

def sfunload(self, sfid, update_midi_preset=0): (source)

Unload a SoundFont and free memory it used

def start(self, driver=None, device=None, midi_driver=None, midi_router=None): (source)

Start audio output driver in separate background thread

Call this function any time after creating the Synth object. If you don't call this function, use get_samples() to generate samples.

Optional keyword argument: driver : which audio driver to use for output device : the device to use for audio output midi_driver : the midi driver to use for communicating with midi devices see http://www.fluidsynth.org/api/fluidsettings.xml for allowed values and defaults by platform

def system_reset(self): (source)

Stop all notes and reset all programs

def tuning_dump(self, bank, prog): (source)

Get tuning information for given bank and preset

Return value is an array of length 128 with tuning factors for each MIDI note. Tuning factor of 0.0 in each position is standard tuning. Measured in cents.

audio_driver = (source)

Undocumented

custom_router_callback = (source)

Undocumented

midi_driver = (source)

Undocumented

Undocumented

Undocumented

settings = (source)

Undocumented

Undocumented