How to pitch shift UP in real time ?

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

I've been thinking about this for a while.

How does one pitch shift up in real time, for example one octave above ?

To pitch shift up one simple technique is to read the sound at twice the speed, but then you need twice more samples, which is impossible in real time.

What techniques are used, for example in Guitar Rig's pitch pedal, or even whammy pedals, to shift the sound up in real time ? Does anyone know ?


Post

Thanks a lot.

I've seen Stephan's code but I wanted to avoid the 1024/4096 samples delay....well it seems I have no choice ! Thanks again.

Just out of curiosity, is this how it works on a whammy pedal too ?

Post

Just a hint for those who want to work with this code.

There's a C version with a lot of explanations here :
http://blogs.zynaptiq.com/bernsee/pitch ... ng-the-ft/

The "stride" value isn't explained but it's simply the number of channels !

Post

One octave up: Some old guitar pedals did this simply by taking the absolute value (rectification).

https://en.wikipedia.org/wiki/Octave_effect

New, more sophisticated methods all have latency as far as I know.

Post

Please note there is a fair amount of misdirection in those links. The best way to pitch shift is not moving the frequencies up and down, which is messy and often inaccurate. It's actually to time stretch the signal then resample it, which makes more sense. Not easy in real-time though, as it causes huge latency.

Post

Have you tried granular pitch shifting? It's a time domain technique that is really fast. It involves keeping a sample history and having two buffer reads that are positioned half the buffer size apart. These read the past samples at the desired speed, and to prevent the buffer loop being heard, each read is faded in and out at the buffer boundaries. Because they loop alternatively you don't hear the loop as one fades in as the other fades out.
It's a neat technique but the loop size has to be about 2000 samples or so as to not lose the lowest frequencies in the audio.

Post

Oh thanks ! Does this technique work only for one octave up or for any pitch shift ? Do you have a link for a reference implementation ? Does this do high quality pitch shifting ?

Post

PSOLA (Pitch Synchronous Overlap-Add) and WSOLA (Waveform Sychronized Overlap-Add) are common.

http://iris.elf.stuba.sk/JEEEC/data/pdf/1_110-08.pdf
http://citeseerx.ist.psu.edu/viewdoc/do ... 1&type=pdf

You effectively use a frequency counter to peg the fundamental pitch of the input waveform and then cross-fade the additional cycles required for the target pitch shift into each other. The more complicated versions of this approach try to dynamically determine how to mix those additional waveforms in based on how similar they are (in terms of harmonics and envelope) to specific portions of the input waveform. The more complex you go the tougher it becomes to do real-time processing.

You can go up as high as you please with either of those implementations but you'll often see more and more harmonic artifacts unless you've got some clever processing happening.
Snare drums samples: the new and improved "dither algo"

Post

not what you're looking for, but something that might be nice to find -

how about using predictive algorithms recursively? i'm sure the results would be "interesting," and the finite scope of windowed method would be a perfect venue for the method.

maybe not something you can sell punters, but experimental, yes..
you come and go, you come and go. amitabha neither a follower nor a leader be tagore "where roads are made i lose my way" where there is certainty, consideration is absent.

Post Reply

Return to “DSP and Plugin Development”