Product
Dual-engine pitch shifting: WSOLA vs phase vocoder DSP
How Infinite's Pitch Shifter pairs correlation-steered WSOLA (1-sample latency) with a 4096-point phase-locked STFT vocoder and live PDC switching.

on this page
Every real-time pitch shifter faces a structural trade-off between latency and polyphony. A time-domain delay-line shifter splices waveforms in a circular buffer with almost no delay, keeping monophonic vocals, basslines, and drum hits tight. However, a single time-domain splice can only align one fundamental period at a time, so polyphonic chords beat and warble. A frequency-domain phase vocoder solves polyphony by moving every spectral partial independently, but it requires an FFT window of thousands of samples, adding tens of milliseconds of latency and smearing sharp transients unless onsets are handled explicitly.
Rather than forcing one compromise on every signal, Infinite implements dual-engine pitch shifting inside a single Pitch Shifter node (PitchShiftKernel in src/audio/dsp/PitchShiftKernel.h and SpectralPitchShifter in src/audio/dsp/SpectralPitchShifter.h). In its default mode, it runs a correlation-steered WSOLA delay line with 1-sample latency. Toggling spectral switches to a 4096-point, identity-phase-locked STFT vocoder, while the audio graph's lock-free PDC system automatically re-aligns parallel branches on the fly.

Why fixed two-tap delay shifters fail
The simplest textbook pitch shifter reads from two delay taps spaced half a grain apart with permanent triangular crossfade weights. That approach has two measurable flaws:
- Permanent comb filtering: Even at 0 semitones, summing two taps separated by half a grain creates a comb filter that never nulls against the dry signal.
- Blind-splice modulation: Jumping at fixed intervals without checking waveform phase produces grain-rate amplitude modulation (measured at
-9 dBof spurious sidebands at+12semitones in Infinite'sPITCHTESTfixture).
PitchShiftKernel replaces the dual-tap comb with a single active tap reading through a Hermite-interpolated DelayLine, plus a second tap that is brought in only during a splice. At 0 semitones, the tap sits 1 sample behind the newest input sample and does not crossfade, making the effect transparent with a 1-sample latency.
Time-domain mode: correlation-steered WSOLA
When shifting up (drift = 1 - 2^(st/12) < 0), the read tap catches up toward the write head and must jump back by 0.5 to 1.0 grain (grain is clamped to 10..250 ms). When shifting down, it drifts toward the end of the buffer and jumps forward. Instead of jumping to a blind offset, PitchShiftKernel::FindSplice() searches for the lag whose recent waveform best matches the current tap:
- Mono-sum correlation:
FindSplice()evaluates normalised cross-correlation on theL + Rsum (mLineL.SampleAtDelay(k) + mLineR.SampleAtDelay(k)). Because both channels share the chosen splice offset, stereo imaging stays locked during jumps. - Coarse-then-fine search: To keep CPU cost predictable on the audio thread, the search evaluates every second lag and every second sample across the comparison window (up to
15 ms), then refines at single-sample resolution within±2samples of the coarse winner. - Raised-cosine linear-sum crossfade: Once a phase-aligned target is found, the two taps crossfade over
0.3 * grain(clamped to3..30 ms) usingwNew = 0.5 - 0.5 * cos(pi * t), which preserves constant amplitude for two phase-aligned copies of the same waveform.
Transient steering around drum hits
Even a phase-aligned splice breaks down if its jump spans a drum transient: jumping back replays the hit (a stutter), while jumping forward skips it completely. PitchShiftKernel tracks the most recent onset using a fast (0.5 ms) and slow (50 ms) envelope pair on |inL| + |inR|. An onset is latched when mEnvFast > 4.0 * mEnvSlow + 1e-3, and re-arms once the fast envelope settles below 1.5 * mEnvSlow.
When a splice is triggered, steer() checks whether the jump range crosses mOnsetDelay. If so, it shortens the maximum jump to land 1 ms short of the onset (and scales the crossfade down to as little as 3 ms if needed) so the attack front passes untouched before the tap jumps.
An optional analog toggle adds a subtle 17.3 Hz (0.35-sample) sinusoidal read jitter, a 4th-order 9 kHz TPT state-variable lowpass reconstruction filter, and asymmetric tanh saturation (AsymTanh(..., 0.12f)) to emulate vintage hardware harmonisers.
Spectral mode: 4096-point phase-locked STFT
For polyphonic chords, pads, and full mixes, spectral mode hands processing to SpectralPitchShifter, a streaming STFT phase vocoder (75% overlap, N = 4096, hop = 1024, Hann analysis and synthesis windows):
- Why 4096 samples instead of 2048: At 48 kHz, a 2048-point FFT has
23.4 Hzbin spacing, which merges closely voiced triad partials around220..330 Hzunder the Hann main lobe. In Infinite'sPITCHTESTchord benchmark, raisingNfrom 2048 to 4096 dropped inter-partial spurious energy from-1.5 dBto-54 dB. - Zero-phase framing: Before the forward FFT, each windowed frame is rotated by
N / 2so the window centre sits at sample0. That aligns main-lobe bins to a shared phase rather than alternating signs bin-to-bin, which is essential for interpolating complex spectra without self-cancellation. - Sidelobe-safe peak picking: Bins above a
-80 dBrelative floor (1e-4of the frame maximum) are promoted to spectral peaks only if they are local maxima across±2bins and their measured instantaneous frequency sits within±1.0bin of their own bin index, preventing window sidelobe ripples from stealing their own regions. - Identity phase locking and fractional resampling: Following Laroche and Dolson (1999), each peak's valley-to-valley region is shifted by the exact fractional bin offset
inst * (ratio - 1)and rotated as a rigid block to match the peak's advancing synthesis phase. Whole-bin rounding was rejected because leaving content off the frequency its phase advances at creates-16 dBframe-rate beating sidebands an octave down. - Spectral flux onset reset: If summed positive bin magnitude rise exceeds
0.3of total frame magnitude (kOnsetFlux = 0.3f), synthesis phases reset to analysis phases so percussive attacks retain their shape instead of smearing across the 4096-sample window.
At 0 semitones, SpectralPitchShifter passes frames through unmodified, yielding an exact reconstruction delayed by 4096 samples (~85.3 ms at 48 kHz). For deeper custom spectral transforms, Infinite also exposes real-time STFT phase vocoder kernels in Field.
Live PDC switching and dry-path alignment
Switching spectral from 0 to 1 on a live node changes LatencySamples() from 1 sample to 4096 samples. If plugin delay compensation stayed frozen at the old topology snapshot, any parallel wet/dry bus would immediately comb or echo.
Once per UI frame, PollAudioLatencyChanges() in src/app/graph/AudioTopology.cpp compares every live node's LatencySamples() against gTopologyLatencySnapshot. Whenever a node's reported latency changes, the graph rebuilds PDC delays automatically, and AudioEffectNode's internal dry path tracks LatencySamples() so mix = 0 remains sample-accurate across live mode switches.
Honest limits and trade-offs
- No formant preservation: Both engines shift formants along with pitch, so large shifts on vocals will sound brighter or deeper rather than formant-locked.
- Spectral latency: Toggling
spectralintroduces4096samples (~85 msat 48 kHz) of latency, which makes it better suited to mixing, sound design, and playback than live monitoring. - Project scope: Infinite is a young, active project: it does not ship an AAX plugin target, and hardware audio inputs are refused in headless CLI mode.
Try it in Infinite
Download Infinite, drop a Pitch Shifter after Analog, Sampler, or Audio In, and compare classic correlation-steered mode on drums against spectral mode on sustained chords. You can also explore ready-made effect and synth chains in the Infinite preset library.