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

Here is an example of the fluidLoad opcode. It uses the file fluidLoad.csd and 07AcousticGuitar.sf2.

Example 291. Example of the fluidLoad opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
-odac   -+rtmidi=virtual  -M0    ;;;realtime audio out and realtime midi in
;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
; For Non-realtime ouput leave only the line below:
;-o fluidLoad.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1

giengine fluidEngine
; soundfont path to manual/examples
isfnum	 fluidLoad "07AcousticGuitar.sf2", giengine, 1
	 fluidProgramSelect giengine, 1, isfnum, 0, 0

instr 1

	mididefault   60, p3
	midinoteonkey p4, p5
ikey	init p4
ivel	init p5
	fluidNote giengine, 1, ikey, ivel

endin

instr 99

imvol  init 7
asigl, asigr fluidOut giengine
       outs asigl*imvol, asigr*imvol

endin
</CsInstruments>
<CsScore>

i 1 0 2 60 100 ;play one note from score and...
i 99 0 60      ;play virtual keyboard for 60 sec.
e

</CsScore>
</CsoundSynthesizer>


The output should include a line like this:

SoundFont:   1  Bank:   0  Preset:   0  Seagul Acoustic Git
      

See Also

fluidEngine, fluidNote

More information on soundfonts in the Floss Manuals: http://en.flossmanuals.net/csound/ch048_d-reading-midi-files

Other information on soundfonts on Wikipedia: http://en.wikipedia.org/wiki/Soundfont

Credits

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

New in Csound5.00