fluidNote

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

Syntax

fluidNote ienginenum, ichannelnum, imidikey, imidivel

Description

Plugin opcode in fluidOpcodes. This opcode is part of the plugin repository and has to be installed separately. The plugin repository can be found here: https://github.com/csound/plugins

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

Initialization

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)

Examples

Here is an example of the fluidNote opcode. Play fluidNote.csd and 19Trumpet.sf2

Example 342. Example of the fluidNote 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 fluidNote.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 "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

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:  56  Trumpet metallic
      

See Also

fluidEngine, fluidLoad

More information on soundfonts is in the Floss Manuals: https://flossmanual.csound.com/midi/reading-midi-files

For other information on soundfonts look in the Wikipedia: http://en.wikipedia.org/wiki/Soundfont

Credits

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