|
I am attempting to play through a soundfont using the fluid synthesizer. I
have found examples on how this is done and I have managed to produce an
output. It seems that I can't send a control change, such as pedal up/down
notation, and in fact I can't produce any control change manually via calls
to fluidControl. I have been able to do so through midi. I modified an
example to play a single midi file:
; Select audio/midi flags here according to platform
; Audio out Audio in No messages
-odac -iadc -d -F test.mid ;;;RT audio I/O
; For Non-realtime ouput leave only the line below:
; -o linsegr.wav -W ;;; for file output any platform
sr = 44100
kr = 4410
ksmps = 10
nchnls = 2
0dbfs = 32767
; LOAD SOUNDFONTS
gienginenum1 fluidEngine
isfnum1 fluidLoad "grand.sf2", gienginenum1, 1
; Bright Steinway, program 1, channel 1
fluidProgramSelect gienginenum1, 1, isfnum1, 0, 0
; 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 = 1
ikey = p4
ivelocity = p5
fluidNote gienginenum1, ichannel, ikey, ivelocity
endin
; COLLECT AUDIO FROM ALL SOUNDFONTS
instr 100 ; Fluidsynth output
; INITIALIZATION
; Normalize so iamplitude for p4 of 80 == ampdb(80).
iamplitude1 = ampdb(p4)
; AUDIO
aleft1, aright1 fluidOut gienginenum1
outs (aleft1 * iamplitude1), (aright1 * iamplitude1)
endin
i 100 0 60 80
e
This sounds as I would expect it to sound, complete with sustain pedal. I
could also manually drive it through the score with something like
i 1 0 0.5 57 45 ; play note 57 for 0.5 seconds with velocity 45
So it's just using the fluidNote opcode. How could I generate a sustain
pedal control change from a score? I was under the impression it was
something like
fluidControl gienginenum1, 176, 1, 64, 127
I have tried something like this but with no luck. It just doesn't seem to
work for me . |