How it works
A pitchshifting algorithm
chops up a sound into granules
. It then plays each granule back several times, not necessarily integer
, at a higher speed. This way, the pitch
changes while the overall duration
For example, let's examine a simple sine wave with a frequency of 440 Hz. The period of this wave is 1/440th of a second. In an ideal case we can get a granule that is exactly one period long, or any integer number of periods for that matter. Since this is as ideal as we're going to get, let's take any multiple of 1/440 seconds. Now, the pitchshifter takes grains of that length and plays each one back twice at double the speed. This results in a one octave pitchshift.
Unfortunately, pitchshifting like this is is only possible if you are doing sinewaves with equal periods. When pitchshifting a complex waveform (like a guitar part) it is impossible to choose a grain size of which the edges will coincide with the ends of all periods. In that case, pitchshifting will produce unwanted artifacts in the frequency domain that change the timbre of the sound.