How to pitch shift UP in real time ?
-
- KVRist
- Topic Starter
- 106 posts since 14 Nov, 2009
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 ?
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 ?
- KVRAF
- 2117 posts since 24 Feb, 2004 from Germany
-
- KVRist
- Topic Starter
- 106 posts since 14 Nov, 2009
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 ?
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 ?
-
- KVRist
- Topic Starter
- 106 posts since 14 Nov, 2009
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 !
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 !
- KVRAF
- 3060 posts since 10 Nov, 2013 from Germany
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.
https://en.wikipedia.org/wiki/Octave_effect
New, more sophisticated methods all have latency as far as I know.
-
- KVRian
- 614 posts since 7 Jan, 2009 from Gloucestershire
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.
-
- KVRian
- 614 posts since 7 Jan, 2009 from Gloucestershire
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.
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.
-
- KVRist
- Topic Starter
- 106 posts since 14 Nov, 2009
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 ?
-
- KVRAF
- 1702 posts since 26 Feb, 2008
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.
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"
-
- Banned
- 12368 posts since 30 Apr, 2002 from i might peeramid
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..
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.