How Does Audio Time-Stretching Preserve Pitch?
Time-stretching algorithms alter the duration or tempo of an audio signal without changing its original pitch by decoupling playback speed from frequency playback rate. Rather than speeding up or slowing down the entire waveform—which causes the classic "chipmunk" or slowed-down pitch shifting—modern digital signal processing utilizes either time-domain techniques like Pitch-Synchronous Overlap-Add (PSOLA) or frequency-domain methods such as the Phase Vocoder. These algorithms analyze the audio, break it into manageable grains or spectral frames, adjust the spacing between those frames, and reconstruct the signal while preserving harmonic relationships and transient sharpness.
The Resampling Dilemma
In analog tape machines and simple digital playback systems, changing tempo inherently changes pitch. Halving the playback time of a recorded sound doubles the frequency of all its sound waves, raising the pitch by an octave. Conversely, stretching the playback duration stretches the wavelengths, lowering the pitch.
To manipulate tempo independently of pitch, algorithms cannot simply resample or alter playback speed. They must selectively add or remove redundant cycles in sustained sounds while keeping individual wave cycles oscillating at their original frequencies.
Time-Domain Methods: Slicing and Overlapping
Time-domain algorithms work directly on the audio waveform. These methods are computationally efficient and excel with monophonic material like solo vocals or single acoustic instruments.
- Overlap-Add (OLA): The algorithm slices audio into short, overlapping segments known as grains. To slow down audio, it duplicates segments and crossfades them; to speed up audio, it discards segments.
- Synchronized Overlap-Add (SOLA): Simple OLA causes severe phase cancellation and comb filtering when grains are overlaid out of sync. SOLA calculates the cross-correlation between adjacent grains, shifting their positions slightly to align matching peaks and troughs before crossfading.
- Pitch-Synchronous Overlap-Add (PSOLA): PSOLA tracks the fundamental frequency (\(f_0\)) of a monophonic sound in real time. It places analysis windows at precise pitch periods. When stretching the audio, entire pitch periods are duplicated and blended synchronously, preserving the original waveform shape and fundamental pitch without phase mismatch.
Frequency-Domain Methods: The Phase Vocoder
Polyphonic music—such as full song mixes or complex chords—contains multiple overlapping fundamental frequencies, rendering pitch-tracking time-domain methods ineffective. Modern digital audio workstations (DAWs) rely heavily on frequency-domain processing via the Phase Vocoder.
The Phase Vocoder decomposes incoming audio using the Short-Time Fourier Transform (STFT). The audio is split into thousands of narrow, overlapping time windows and converted from amplitude over time into frequency and phase over time.
- Analysis: The algorithm measures the magnitude (loudness) and phase (instantaneous wave position) of every frequency bin across successive time frames.
- Time Adjustment: The distance between consecutive analysis frames (hop size) is changed during resynthesis. Expanding the hop size slows the sound down, while compressing it speeds the sound up.
- Phase Propagation: When frames are moved further apart or closer together, their raw phase values no longer align, which would normally create hollow, reverberant artifacts known as "phasiness." The Phase Vocoder computes the instantaneous frequency of each bin and updates the phase values mathematically to ensure smooth wave continuity from frame to frame.
- Synthesis: The Inverse Short-Time Fourier Transform (ISTFT) converts the modified spectral frames back into a continuous time-domain audio stream.
Handling Transients and Formants
Pure spectral stretching can blur rapid percussive hits, turning sharp drum attacks into soft, smeared noises. To prevent this, advanced production algorithms employ hybrid techniques:
- Transient Detection: Algorithms detect sharp energy spikes (drum hits, pick attacks, consonants) and separate them from sustained harmonic beds. Transients are preserved in the time domain without stretching, while sustained harmonic content is routed through the spectral vocoder.
- Formant Preservation: Human vocal tracts create static resonant peaks called formants. When natural vocalists sing higher or lower, their vocal tract size remains the same. Advanced algorithms apply spectral envelope tracking to ensure these formant peaks remain stationary during pitch and time adjustments, avoiding unnatural "mickey-mousing" artifacts.
Through the combination of phase vocoding, synchronized waveform overlapping, and intelligent transient separation, digital audio workstations provide transparent tempo manipulation that maintains the musical integrity of original recordings.