fluidNote — Plays a note on a channel in a fluidSynth engine.


fluidNote ienginenum, ichannelnum, imidikey, imidivel


Plays a note at imidikey pitch and imidivel velocity on ichannelnum channel of number ienginenum fluidEngine.


ienginenum -- engine number assigned from fluidEngine

ichannelnum -- which channel number to play a note on in the given fluidEngine

imidikey -- MIDI key for note (0-127)

imidivel -- MIDI velocity for note (0-127)


Here is an example of the fluidNote opcode. It uses the file fluidNote.csd and 19Trumpet.sf2.

Example 280. Example of the fluidNote opcode.

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

; 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 fluidNote.wav -W ;;; for file output any platform

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

giengine fluidEngine
; soundfont path to manual/examples
isfnum	 fluidLoad "19Trumpet.sf2", giengine, 1
	 fluidProgramSelect giengine, 1, isfnum, 0, 56

instr 1

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


instr 99

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


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


The output should include a line like this:

SoundFont:   1  Bank:   0  Preset:  56  Trumpet metallic

See Also

fluidEngine, fluidLoad

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


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