fluidLoad

fluidLoad — Loads a SoundFont into a fluidEngine, optionally listing SoundFont contents.

Syntax

isfnum fluidLoad soundfont, ienginenum[, ilistpresets]

Description

Loads a SoundFont into an instance of a fluidEngine, optionally listing banks and presets for SoundFont.

Initialization

isfnum -- Number assigned to just-loaded soundfont.

soundfont -- String specifying a SoundFont filename. Note that any number of SoundFonts may be loaded (obviously, by different invocations of fluidLoad).

ienginenum -- engine number assigned from fluidEngine

ilistpresets -- optional, if specified, lists all Fluidsynth programs for the just-loaded SoundFont. A Fluidsynth program is a combination of SoundFont ID, bank number, and preset number that is assigned to a MIDI channel.

Performance

Invoke fluidLoad in the orchestra header, any number of times. The same SoundFont may be invoked to assign programs to MIDI channels any number of times; the SoundFont is only loaded the first time.

Examples

sr = 44100
kr = 4410
ksmps = 10  
nchnls = 2
0dbfs = 32767

; LOAD SOUNDFONTS

fluidLoad	"Piano Steinway Grand Model C (21,738KB).sf2", 1, 1, 1 ; Bright Steinway, program 1, channel 1
fluidLoad	"Piano Steinway Grand Model C (21,738KB).sf2", 2, 3, 1 ; Concert Steinway with reverb, program 2, channel 3
fluidLoad	"63.3mg The Sound Site Album Bank V1.0.SF2",  50, 2, 1 ; General MIDI, program 50, channel 2

; SEND NOTES TO STEINWAY SOUNDFONT

instr 1 ; FluidSynth Steinway Rev
; INITIALIZATION
                   mididefault                  60, p3 ; Default duration of 60 -- overridden by score.
                   midinoteonkey                p4, p5 ; Channels MIDI input to pfields.
; Use channel assigned in fluidLoad.
ichannel           =                            3
ikey               =                            p4
ivelocity          =                            p5
istatus            =                            144
                   fluidcontrol                 istatus, ichannel, ikey, ivelocity
endin

; COLLECT AUDIO FROM ALL SOUNDFONTS

instr 100 ; Fluidsynth output
; INITIALIZATION
; Normalize so iamplitude for p5 of 80 == ampdb(80).
iamplitude         =                           ampdb(p5) * (10000.0 / 0.1)  
; AUDIO
aleft, aright      fluidout
                   outs                        aleft * iamplitude, aright * iamplitude
endin

Credits

Michael Gogins (gogins at pipeline dot com), Steven Yi. Thanks to Peter Hanappe for Fluidsynth.