web synth docs

pitch-shifting

There are several different methods for pitch shifting. There's a Wikipedia Article with a ton of info as well.

If you speed up a sample, the pitch will go up. For some use cases such as sampled synthesizers or other instruments without much [aperiodicity], this can be sufficient and it's very simple to implement. However, for more complicated sounds such as speech, the sound will be distorted dramatically or lose its character in other ways. The main challenge with pitch shifting is

Granular Synthesis

[granular-synthesis] can be used for pitch shifting while preserving playback speed. This is accomplished by picking small, overlapping windows of sound and moving the start point of these windows faster or slower to cancel out the effect of the changing playhead speed to used to accomplish the pitch shifting itself.

In my experience, it works quite well in general. There can be some distortion of the sound caused by the use of adding volume envelopes on the windows to prevent clicking or other artifacts, and when shifting sound down the windows can become audible and be noticable.

This functionality is implemented in the web synth [granular-synthesizer] [module].

FFT-Based Methods / Phase Vocoder

One method that's apparently been around since the 60s is called the Phase Vocoder. I've not tried anything related to this, but as far as I can tell you use a sliding-window FFT (STFT) to convert the input signal into the frequency domain, shift the resulting FFT buckets up or down to do your pitch shifting, and then perform inverse STFT to generate an output signal. I assume there's some extra steps in there to deal with phase correction or whatever and apparently there's been some advancements + improvements to this in the decades since its development, but it seems like a relatively straightforward idea that could be cool to try to implement at some point.

pitch-shifting