pyfluidsynth
pyfluidsynth copied to clipboard
pitch_bend doesn't work from Python
I have fluid-synth installed from homebrew and pyfluidsynth installed from pip (plus I had to edit the pyfluidsynth code so it could find the fluid-synth library).
I have verified that fluid-synth itself supports pitch bending by using its command line tool and giving it commands.
But the pitch_bend API doesn't seem to work in python. Here's a code sample that demonstrates the problem. I should hear two different notes, but this plays the same one twice.
import time
import fluidsynth
fs = fluidsynth.Synth(samplerate=44100.0)
fs.start()
sfid = fs.sfload('FluidR3_GM.sf2') # replace path as needed
fs.program_select(0, sfid, 0, 0)
time.sleep(1.0)
fs.pitch_bend(0, 8192)
fs.noteon(0, 60, 127)
time.sleep(1.0)
fs.noteoff(0, 60)
fs.pitch_bend(0, 10000)
fs.noteon(0, 60, 127)
time.sleep(3.0)