Best options for fastest latency real-time pitch shifting in MSP?

atarirob's icon

I want to make a stereo delay that includes a pitch shifter before the feedback line, something akin to the classic Eventide 'Crystals' sound that their Ultra-Harmonizers are famous for.

I'm doing this mostly just to get some practice with MSP, I have a H8000FW sat directly to my left, so this is more just for fun :)

The problem I'm facing is that I cannot find a way of implementing real-time pitch shifting that has acceptable latency. The pitchshift~ object sounds okay, but has severe latency. gizmo~ similarly introduces a lot of latency.

I've experimented a bit with abusing the doppler effect by using a phasor~ to modulate a tapout~'s delay time, but of course this introduces a fair bit of latency too, as expected!

Are there any other DSP tricks for real-time pitch sifting? Quality isn't a big concern, just something that has latency good enough to be used with short delay times.

sousastep's icon

download the RNBO Guitar Pedals package and check out its PitchShifter

The H9000 supports RNBO and gen~ BTW. Would be cool if Eventide worked out a deal with Cycling to port some VSig3 modules to Max 👀

Jean-Francois Charles's icon

Indeed, the crystal Eventide algorithm(s) are time-based; they read the delay lines at various speeds to get the pitch shifting.

Roman Thilenius's icon

not sure why you would need RNBO or gen~ to do that, but i´d also choose ganular/tappingbuffer based pitching for this kind of application.

the otherwise not so useful oscillating artefacts of such an algo - or the difficulty to modulate the pitch in realtime - is no longer a problem when used inside a feedback loop.

but please upsample 4 times!

atarirob's icon

Thanks for the replies, everyone! I'm did a little more experimenting and am getting some reasonable results expanding on the delay line method, introducing time offsets to compensate for 'latency' (although I guess in this instance it's more like the delay just doing it's job!) and phase offsets to compensate for clicks caused by the phasor~ reaching the peak of it's ramp. Once it gets to a point I would deem usable I will upload the patcher here to help anyone else stumbling on this thread.


Roman, could you please expand on what you mean by using a granular/tappingbuffer and using a feeback loop for pitch shifting? I would very much appreciate it :)

And sousastep, yes I saw that too!! I really want a 9000 now...who needs two kidneys, anyway?

Thanks again, guys.

Mitch Triplett's icon

"...Roman, could you please expand on what you mean by using a granular/tappingbuffer and using a feeback loop for pitch shifting? I would very much appreciate it :)..."

I would also appreciate it if you could expand on this. Thanks!!

Roman Thilenius's icon

it is almost the same technique as the most (searchterm:) variable delay lines uses:
you write into tapin~ in realtime (i.e. with a speed of 1x), and then read it out with different speeds to obtain a pitch shift.

https://cycling74.com/forums/can-anyone-explain-the-basics-of-vdb

because of the normative force of the factual, you have to use a windowing system to continuously alternate between 2 or 3 of such buffers.

the requested property of having a very low latency is not met with this (unless you run the windowing oscillation at higher frequencies, which can cause nasty artefacts) for pitch-up, but this is true for most pitch shifting methods. for pitch-down it is less a problem.


and as you all can imagine, any bit of latency can have dramatic effects when applied inside a feedback loop, where it accumulates up.

👽'tW∆s ∆lienz👽's icon

just to be complete, the RNBO guitar pedals patch is basically the same as in the 'pitchshifting-playground' example: Max Help menu-> Examples-> effects-> transposer-folder-> 'pitchshifting-playground'

this type of pitch-shifting algo is the fastest in terms of latency because it doesn't rely on analysis, just the idea of 'doppler shift'(the pitch-shifting magic happens because the 'read' operation is a constant change in speed, not just a constant speed)

makes you wonder: if a person travelling at a constant speed, observes someone else who is travelling at a speed which is constantly changing according to the trajectory of a phasor ranging from just below that speed to just above that speed, will that person sound like a chipmunk? 🐿

someday when we run quantum computers that can achieve something that is akin to multiple sample-rates for multiple outcomes at a time, then we'll have no latency(maybe we'll have negative latency because we'll be able to visit the past and tell our past selves to anticipate all the changes we saw(note to self: don't try applying for any of the jobs at cycling74, it never works out for you🕴)).

in the meantime, we still have Doppler.