Lesson Objective
This lesson explains how time stretching and pitch shifting algorithms work and how to use them effectively in music production. You will learn the difference between time stretching (changing tempo without affecting pitch) and pitch shifting (changing pitch without affecting tempo), understand the major algorithm types and their sonic characteristics, and apply these tools for both corrective and creative purposes in your productions.
What You Will Learn
- The fundamental difference between time stretching and pitch shifting
- How phase vocoder algorithms work for time and pitch manipulation
- Granular synthesis-based time stretching and its characteristics
- How to choose the right algorithm for different audio material
- Corrective applications: matching loops to project tempo, fixing timing
- Creative applications: pitch shifting for harmonies, tempo manipulation for effects
- Understanding and managing artifacts from time stretching and pitch shifting
Required Knowledge or Tools
Time stretching and pitch shifting are built into most modern DAWs. Understanding basic audio concepts like sample rate, tempo, and pitch will help you use these tools effectively.
- Completion of Lessons 1–5 (foundational audio concepts)
- A DAW with time stretching capabilities (all major DAWs include this)
- Audio loops or recordings to experiment with
- Optional: dedicated time stretching tools like Elastique, zplane élastique, or iZotope RX
Core Concept Explanation
In the physical world, changing the playback speed of a recording changes both its tempo and its pitch simultaneously — play a tape faster and it sounds higher and shorter; play it slower and it sounds lower and longer. Time stretching and pitch shifting are digital signal processing techniques that break this relationship, allowing you to change tempo and pitch independently.
Time Stretching vs. Pitch Shifting
Time stretching changes the duration of an audio file without changing its pitch. A four-bar drum loop recorded at 90 BPM can be stretched to play at 120 BPM without the drums sounding higher in pitch. This is essential for matching loops and samples to the tempo of a project.
Pitch shifting changes the pitch of an audio file without changing its duration. A vocal recorded in the key of C can be shifted up a perfect fifth to G without changing the timing of the performance. This is used for creating harmonies, transposing samples to match a song's key, and creative pitch effects.
Key Relationship: Time stretching and pitch shifting are mathematically related operations. Most algorithms perform one by internally doing both and then compensating for the unwanted change. This is why both operations introduce similar types of artifacts and why the quality of the algorithm matters so much.
Phase Vocoder Algorithm
The phase vocoder is the most widely used algorithm for time stretching and pitch shifting. It works by converting the audio signal from the time domain to the frequency domain using a Short-Time Fourier Transform (STFT). In the frequency domain, the signal is represented as a series of frequency bins, each with an amplitude and phase value.
To stretch time, the algorithm spreads the frequency domain frames further apart in time, then converts back to the time domain. To shift pitch, it scales the frequency values of each bin up or down, then converts back. The phase vocoder produces clean, artifact-free results for moderate amounts of processing (up to about 20–30% time change or 3–4 semitones of pitch shift), but introduces characteristic "phasiness" and smearing artifacts at more extreme settings.
Granular Synthesis-Based Time Stretching
Granular time stretching works by cutting the audio into tiny overlapping segments called grains (typically 20–100 ms long) and rearranging them to create the desired duration. To stretch audio, grains are repeated or overlapped. To compress audio, grains are skipped or shortened.
Granular algorithms can handle extreme time stretching ratios that would destroy a phase vocoder, but they introduce their own characteristic artifacts: a "grainy" or "stuttering" quality, particularly on transient-rich material like drums. At extreme stretch ratios (4x or more), granular stretching creates a distinctive ambient, textural sound that is used intentionally in experimental and electronic music.
Choosing the Right Algorithm
Different audio material responds better to different algorithms. Most DAWs offer multiple algorithm options, and choosing the right one significantly affects the quality of the result.
For melodic material (vocals, sustained instruments), phase vocoder algorithms generally produce the cleanest results for moderate amounts of processing. For rhythmic material (drums, percussion), algorithms optimized for transient preservation produce better results by keeping the attack of each hit sharp and clear. For polyphonic material (full mixes, chords), algorithms that analyze the harmonic content produce better results than those designed for monophonic signals.
Algorithm Selection: In Ableton Live, the Complex and Complex Pro warp modes use phase vocoder algorithms and work best for melodic and polyphonic material. The Beats mode uses a transient-based algorithm optimized for rhythmic material. In Logic Pro, the Flex Time modes offer similar options. Always experiment with different algorithms and choose the one that sounds best for your specific material.
Creative Applications
Beyond corrective use, time stretching and pitch shifting are powerful creative tools. Extreme time stretching creates ambient, textural soundscapes from ordinary recordings. Pitch shifting a drum loop down by an octave creates a heavy, lo-fi sound. Pitch shifting a vocal up by a fifth creates an instant harmony. Stretching a short sample to fill a longer time slot creates interesting rhythmic and tonal transformations.
Many producers intentionally use the artifacts of time stretching as a creative element. The grainy, smeared quality of heavily stretched audio has become a signature sound in genres like lo-fi hip-hop, ambient, and experimental electronic music.
Visual Explanation
Time stretching in an audio editor visually expands or compresses the waveform horizontally while maintaining the same vertical amplitude, representing the change in duration without a change in pitch.
In a DAW's arrangement view, time-stretched clips appear wider or narrower than their original size. Most DAWs display a small icon or indicator on stretched clips to show that time stretching has been applied. The warp markers in Ableton Live, for example, show exactly where the algorithm has been anchored to maintain timing accuracy.
Why This Lesson Matters
Time stretching and pitch shifting are fundamental tools for working with samples and loops in modern music production. The ability to match any sample to your project's tempo and key opens up an enormous library of source material that would otherwise be unusable. Understanding how these algorithms work helps you make better decisions about when to use them, how much processing is acceptable before quality degrades, and how to choose the right algorithm for each situation.
These tools also enable creative workflows that are central to many genres. Sample-based hip-hop relies on pitch shifting to match samples to the song's key. Electronic music production relies on time stretching to synchronize loops from different sources. Ambient and experimental music uses extreme time stretching as a compositional tool. Mastering these techniques expands your creative vocabulary significantly.
Quality Degradation: All time stretching and pitch shifting introduces some degree of quality degradation. The more extreme the processing, the more obvious the artifacts. For critical applications, minimize the amount of processing by choosing source material that is already close to the desired tempo and pitch. A 5% time stretch sounds much better than a 50% stretch.
Step-by-Step Tutorial
Follow this workflow to match a drum loop to your project tempo:
- Identify the Original Tempo: Before stretching a loop, you need to know its original tempo. Many sample libraries include tempo information in the file name or metadata. If not, you can calculate it: count the number of beats in the loop, divide by the loop's duration in seconds, and multiply by 60 to get BPM.
- Import the Loop into Your DAW: Drag the loop into your project. Most DAWs will automatically detect the loop's tempo and offer to stretch it to match the project tempo. Accept this if the automatic detection is correct, or set the original tempo manually if it is wrong.
- Choose the Appropriate Algorithm: Select the time stretching algorithm that best suits the material. For a drum loop, choose a transient-preserving or beats-optimized algorithm. For a melodic loop, choose a tonal or complex algorithm. Experiment with different options and listen to the results.
- Apply the Stretch: Enable time stretching for the clip and set the target tempo to match your project. Listen to the stretched result and evaluate the quality. Pay attention to the transients — are the drum hits still sharp and punchy? Is there any smearing or phasiness?
- Refine with Warp Markers: If the loop has timing inconsistencies or if specific beats need to be aligned more precisely, use warp markers (in Ableton) or similar tools to anchor specific points in the loop to the grid. This gives you fine control over the timing of individual beats within the loop.
- Evaluate and Decide: Listen to the stretched loop in the context of your project. If the quality is acceptable, proceed. If the artifacts are too obvious, consider using a different source loop that is closer to your project tempo, or use a different algorithm. Sometimes the best solution is to find better source material rather than stretching aggressively.
Common Mistakes and Misunderstandings
Mistake 1: Stretching audio too far. Most algorithms produce acceptable results up to about 20–30% time change. Beyond that, artifacts become increasingly obvious. If you need to stretch more than 30%, consider finding source material closer to your target tempo.
Mistake 2: Using the wrong algorithm for the material. Applying a tonal algorithm to a drum loop will smear the transients and make the drums sound soft and indistinct. Always match the algorithm to the type of audio material.
Mistake 3: Confusing time stretching with resampling. Resampling changes both tempo and pitch simultaneously (like changing tape speed). Time stretching changes only tempo. Make sure you are using the right tool for the desired result.
Mistake 4: Not checking the stretched audio at different playback levels. Time stretching artifacts can be masked at high volumes but become obvious at lower levels. Check your stretched audio at different monitoring levels to ensure the quality is acceptable.
Mistake 5: Applying time stretching and pitch shifting simultaneously in large amounts. Each operation introduces artifacts, and combining them compounds the degradation. If you need to change both tempo and pitch significantly, do so in stages and evaluate the quality at each step.
Practical Example or Scenario
A producer is working on a hip-hop track at 95 BPM. He finds a perfect jazz piano loop recorded at 120 BPM that has exactly the chord progression he wants. He needs to slow it down to 95 BPM (a 21% reduction in tempo) and transpose it down by two semitones to match the key of his track.
He imports the loop into Ableton Live and sets the original tempo to 120 BPM. The project tempo is 95 BPM, so Ableton automatically stretches the loop. He selects the Complex Pro warp mode, which is optimized for polyphonic melodic material like piano.
The time-stretched loop sounds good — the piano chords are clear and the timing is accurate. He then applies a pitch shift of -2 semitones using Ableton's transpose function. The loop now plays at 95 BPM in the correct key. He listens carefully and notices a slight phasiness in the sustained chords, which is a characteristic artifact of the phase vocoder algorithm.
He decides the quality is acceptable for his purposes — the lo-fi character of the artifact actually suits the hip-hop aesthetic. He adds some vinyl noise and a gentle low-pass filter to further enhance the vintage feel, and the loop becomes a central element of the track.
Lesson Summary
Time stretching changes audio duration without affecting pitch. Pitch shifting changes pitch without affecting duration. Both operations use algorithms that introduce artifacts, and the quality of the result depends on the algorithm chosen, the amount of processing applied, and the nature of the source material.
Phase vocoder algorithms work best for melodic and polyphonic material with moderate amounts of processing. Granular algorithms handle extreme stretching ratios but introduce a characteristic grainy quality. Transient-preserving algorithms work best for rhythmic material. Always choose the algorithm that best suits your material and minimize the amount of processing to maintain quality.
The next lesson covers Sampling and Sample Libraries, exploring the art of working with pre-recorded audio material to create new music.