Hello,
what is the best way in pd for simulating a pitch wheel, so that I can modulate the pitch in real time by moving a slider?
[pd 0.54 on Linux]
Thanks,
a.
Simulating a pitch wheel
Hello,
what is the best way in pd for simulating a pitch wheel, so that I can modulate the pitch in real time by moving a slider?
[pd 0.54 on Linux]
Thanks,
a.
If your sending MIDI you could do it like this (see the bug note in {bendout} help)
slider-bendout.pd

from the help file of else/sfont~

Interesting that both responses assumed that atux wants to send pitch bend messages out, but "modulate the pitch in real time by moving a slider" says nothing about MIDI being the target.
The question might just as easily be, "How to map a slider onto a frequency ratio, to multiply with the note's main frequency?"
Normalize the slider value. Because pitch bend normally goes both up and down, I normalize to -1 .. +1.
line~ for smoothing. (Also, I'm stealing the mouse-release logic from porres, good tip!)
Pitch bend range is given in semitones. We need a fraction of an octave = pbrange / 12.
Scale the normalized pb value onto the fraction of the octave = [*~].
The ratio for one octave = 2. So, the ratio for the fraction of the octave = 2 ^ fraction.
Now you have a ratio that you can multiply by any frequency, and get pb.

(More generally, almost any kind of exponential modulation i.e. frequency can be expressed as baselineValue * (modRatio ** modulator). Pitch bend is a specific case of this, where modRatio = 2 and the modulator is scaled to the range +-pbrange / 12. Linear modulation just demotes the math ops: baselineValue + (modFactor * modulator). With these 2 formulas you can handle a large majority of modulation scenarios.)
hjh
Oops! Looks like something went wrong!