fluidNote
Plays a note on a channel in a fluidSynth engine.
Syntax
fluidNote ienginenum, ichannelnum, imidikey, imidivel
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
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. It uses the file fluidNote.csd and 19Trumpet.sf2.
Example of the fluidNote opcode. |
---|
| <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
Soundfonts
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.