Tempo-Pitch Curves (Accelerando & Ritardando) — User Guide

Advanced tempo manipulation: applies musical tempo curves (accelerando, ritardando, slow-fast-slow) with flexible pitch behavior using PSOLA resynthesis.

Author: Shai Cohen Affiliation: Department of Music, Bar-Ilan University, Israel Version: 2.0 (2025) License: MIT License Repo: https://github.com/ShaiCohen-ops/Praat-plugin_AudioTools
Contents:

What this does

This script implements musical tempo curve manipulation — applying expressive tempo variations like accelerando (gradual speeding up) and ritardando (gradual slowing down) to audio using PSOLA (Pitch-Synchronous Overlap-Add) resynthesis. The tool provides two distinct processing modes: one that simulates tape-speed effects (pitch changes with tempo) and another that maintains constant pitch while altering duration only.

Key Features:

What are tempo curves in audio processing? Traditional tempo changes: uniform time-stretching, simple speed changes. Advanced tempo curves: Smooth, musical acceleration/deceleration patterns that mimic human performance. Advantages: (1) Musical expressivity: Creates natural-sounding tempo variations. (2) Dual behavior options: Choose between tape-speed effect (pitch changes) or modern time-stretching (pitch constant). (3) Precise control: Adjustable strength and duration parameters. (4) High quality: PSOLA preserves audio quality better than simple resampling. (5) Creative possibilities: Enables effects impossible with analog tape. Use cases: Music production (adding expressivity to rigid performances), film scoring (matching music to visual pacing), sound design (creating tension/release), musicology (studying performance practice), audio restoration (correcting timing issues).

Technical Implementation: (1) PSOLA Analysis: Converts sound to Manipulation object with pitch and pulse markers. (2) Tempo Curve Generation: Creates DurationTier with 31 control points defining tempo pattern. (3) Mode A (Pitch Changes): Applies average pitch shift to simulate tape-speed effect while maintaining formant structure. (4) Mode B (Pitch Constant): Uses PSOLA duration manipulation only, preserving original pitch. (5) Duration Normalization: Optional adjustment to maintain original duration or achieve target duration. (6) Resynthesis: Overlap-add synthesis from modified Manipulation object. (7) Quality Control: Peak normalization and safe parameter limits ensure usable results.

Quick start

  1. In Praat, select exactly one Sound object.
  2. Run script…tempo_pitch_curves.praat.
  3. Choose Pattern_type: Accelerando, ritardando, or slow-fast-slow.
  4. Select Pitch_behavior: Pitch changes (tape-speed) or keep pitch constant.
  5. Set Strength (1 = mild, 2 = medium, 3 = strong).
  6. Choose Duration_mode: Keep original or specify new duration.
  7. If specifying duration, enter Target_duration in seconds.
  8. Enable Play_result_when_finished for immediate preview.
  9. Click OK — processed sound appears as "originalname_pattern".
Quick tip: Start with Strength = 2.0 for noticeable but natural effects. Use Pitch changes with tempo for vintage tape-recorder effects or musical realism. Use Keep pitch constant for modern time-stretching applications. For speech, try ritardando with pitch constant for dramatic emphasis. For music, try accelerando with pitch changes for excitement buildup. Enable Play_result_when_finished to immediately hear the effect. The script automatically handles stereo-to-mono conversion and maintains audio quality through PSOLA resynthesis.
Important: PSOLA LIMITATIONS — PSOLA works best on monophonic sources with clear pitch (voice, solo instruments). Polyphonic music or noisy signals may produce artifacts. Extreme tempo factors (>3× speedup or <0.3× slowdown) can cause quality degradation. Pitch-changing mode affects formant frequencies — very strong effects may create "chipmunk" or "demon" voices. Duration normalization uses additional processing that may slightly affect quality. Original selection is preserved — new Sound object created with "_pattern" suffix. Processing time increases with audio length and complexity.

Tempo Patterns

Pattern 1: Accelerando (slow → fast)

🎵 Gradual Acceleration

Mathematical definition: Linear increase from minTempoFactor to maxTempoFactor

Musical effect: Building excitement, forward momentum, urgency

Best for: Climactic sections, action sequences, energetic passages

Tempo curve calculation:

For 31 control points (i = 0 to 30): t = i × originalDuration / 30 x = i / 30 (normalized position 0→1) Tempo factor at point x: tempoFactor = minTempoFactor + (maxTempoFactor - minTempoFactor) × x Duration factor (inverse): durationFactor = 1.0 / tempoFactor Strength scaling: minTempoFactor = 1.0 - (0.25 × strength) maxTempoFactor = 1.0 + (0.35 × strength) Example (strength=2.0): Start: tempoFactor = 0.5, durationFactor = 2.0 Middle: tempoFactor = 1.175, durationFactor = 0.85 End: tempoFactor = 1.7, durationFactor = 0.59

Pattern 2: Ritardando (fast → slow)

🎵 Gradual Deceleration

Mathematical definition: Linear decrease from maxTempoFactor to minTempoFactor

Musical effect: Relaxation, conclusion, finality, calmness

Best for: Endings, reflective passages, emotional resolution

Tempo curve calculation:

For 31 control points (i = 0 to 30): t = i × originalDuration / 30 x = i / 30 (normalized position 0→1) Tempo factor at point x: tempoFactor = maxTempoFactor - (maxTempoFactor - minTempoFactor) × x Duration factor (inverse): durationFactor = 1.0 / tempoFactor Strength scaling (same as accelerando): minTempoFactor = 1.0 - (0.25 × strength) maxTempoFactor = 1.0 + (0.35 × strength) Example (strength=2.0): Start: tempoFactor = 1.7, durationFactor = 0.59 Middle: tempoFactor = 1.175, durationFactor = 0.85 End: tempoFactor = 0.5, durationFactor = 2.0

Pattern 3: Slow-Fast-Slow

🎵 Arch Form

Mathematical definition: Quadratic curve with peak at center

Musical effect: Symmetric tension and release, balanced form

Best for: Musical phrases, poetic readings, dramatic arcs

Tempo curve calculation:

For 31 control points (i = 0 to 30): t = i × originalDuration / 30 x = i / 30 (normalized position 0→1) Centered coordinate: centered = (x - 0.5) × 2 (range -1 to +1) Tempo factor at point x: tempoFactor = minTempoFactor + (maxTempoFactor - minTempoFactor) × (1 - centered²) Duration factor (inverse): durationFactor = 1.0 / tempoFactor Strength scaling (same): minTempoFactor = 1.0 - (0.25 × strength) maxTempoFactor = 1.0 + (0.35 × strength) Example (strength=2.0): Start: tempoFactor = 0.5, durationFactor = 2.0 Middle: tempoFactor = 1.7, durationFactor = 0.59 End: tempoFactor = 0.5, durationFactor = 2.0

Strength Parameter Effects

StrengthminTempoFactormaxTempoFactorEffect Character
0.50.8751.175Very subtle, barely noticeable
1.00.751.35Gentle, natural expression
2.00.51.7Clear, musical, recommended
3.00.252.05Strong, dramatic effect
4.00.0 → 0.4*2.4 → 3.0*Extreme, potentially artificial
5.00.0 → 0.4*2.75 → 3.0*Maximum, use with caution

*Script clamps factors to safe range 0.4-3.0

Processing Modes

Mode A: Pitch Changes with Tempo (Tape-Speed Effect)

⏩ Analog Tape Simulation

Behavior: Pitch rises with acceleration, falls with deceleration

Technical approach: PSOLA + average pitch shift

Sound character: Vintage, musical, physically realistic

Implementation details:

STEP 1: PSOLA analysis workingSound → To Manipulation (0.01s, 75-600Hz) Extract PitchTier and create DurationTier STEP 2: Apply tempo curve to DurationTier 31 points with calculated duration factors STEP 3: Calculate average pitch shift avgTempoFactor = (minTempoFactor + maxTempoFactor) / 2 Apply to PitchTier: pitch = original_pitch × avgTempoFactor STEP 4: Duration normalization (if keeping original duration) Calculate mean duration factor across curve Scale all points by inverse of mean factor STEP 5: Resynthesis Replace both tiers in Manipulation Get resynthesis (overlap-add) STEP 6: Final duration adjustment (if specified) Use Change gender with formant scaling

Why Average Pitch Shift?

Technical rationale:

Alternative approaches considered: 1. No pitch change: Wouldn't simulate tape effect 2. Continuous pitch curve: Too complex, potential artifacts 3. Average shift: Good compromise, preserves formant ratios Formant preservation: Original formant frequencies: F1, F2, F3... After average shift: F1×avg, F2×avg, F3×avg... Formant ratios maintained: (F2/F1), (F3/F1) unchanged Result: Natural-sounding pitch change Unlike simple resampling that preserves formants absolutely Creates more musical, less "chipmunk" effect

Mode B: Keep Pitch Constant (Modern Time-Stretching)

⏱️ Pure Tempo Manipulation

Behavior: Pitch remains unchanged throughout tempo variations

Technical approach: PSOLA duration manipulation only

Sound character: Modern, clean, "impossible" effect

Implementation details:

STEP 1: PSOLA analysis workingSound → To Manipulation (0.01s, 75-600Hz) Create DurationTier only (keep original PitchTier) STEP 2: Apply tempo curve to DurationTier 31 points with calculated duration factors STEP 3: Duration normalization (if keeping original duration) Calculate mean duration factor across curve Scale all points by inverse of mean factor STEP 4: Resynthesis Replace DurationTier in Manipulation Get resynthesis (overlap-add) STEP 5: Final duration adjustment (if specified) Use Change gender with formant scaling Key difference: Original PitchTier preserved unchanged No pitch multiplication applied Pure duration manipulation

Duration Control Options

Option 1: Keep Original Duration

Normalization algorithm:

Calculation: sumFactors = 0 FOR each of 31 points: Calculate durationFactor for that point sumFactors = sumFactors + durationFactor END FOR meanFactor = sumFactors / 31 Normalization: FOR each of 31 points: normalizedFactor = originalFactor / meanFactor Update DurationTier point END FOR Effect: Integrated duration change = 1.0 Result duration ≈ original duration Tempo pattern shape preserved, overall scale adjusted

Option 2: Specify New Duration

Two-stage adjustment:

Stage 1: PSOLA with tempo curve Apply tempo pattern without duration normalization Result: duration determined by integral of tempo curve Stage 2: Uniform scaling if needed actualDuration = Get total duration IF |actualDuration - targetDuration| > 0.01 scaleFactor = targetDuration / actualDuration Change gender: 75, 600, 1.0, 0, scaleFactor, 1.0 Parameters for Change gender: pitch floor: 75 Hz pitch ceiling: 600 Hz formant scale ratio: 1.0 (preserve formants) pitch scale ratio: 1.0 (preserve pitch) duration scale factor: scaleFactor normalize amplitude: yes Result: Target duration achieved with minimal quality loss

Mode Comparison

AspectMode A (Pitch Changes)Mode B (Pitch Constant)
Sound characterVintage, tape-likeModern, clean
Musical realismHigh (like real performance)Low (impossible effect)
Formant behaviorScaled with pitchPreserved exactly
Best for musicExpressive performanceTechnical applications
Best for speechDramatic readingTiming correction
Artifact riskMedium (pitch shift)Low (pure PSOLA)
Processing timeSlightly longerStandard

PSOLA Technology

What is PSOLA?

Pitch-Synchronous Overlap-Add synthesis:

PSOLA = Analysis + Modification + Resynthesis Analysis phase: 1. Detect fundamental frequency (pitch) 2. Identify pitch pulses (glottal closures) 3. Extract short segments around each pulse Modification phase: 1. Adjust timing of pulses (duration changes) 2. Adjust pulse spacing (pitch changes) 3. Apply overlap-add with new timing Resynthesis phase: 1. Overlap and add modified segments 2. Apply smoothing at segment boundaries 3. Output modified signal Advantages over simple resampling: - Preserves formant structure - Handles pitch and duration separately - Higher quality for vocal sounds - Natural-sounding modifications

PSOLA in Praat

Manipulation Objects

Praat's implementation:

Conversion to Manipulation: sound → To Manipulation: timeStep, pitchFloor, pitchCeiling Contains: - Original sound - PitchTier (continuous pitch contour) - DurationTier (time scaling factors) - PulseTier (analysis markers) Key parameters: timeStep = 0.01 (10 ms analysis frames) pitchFloor = 75 Hz (minimum expected F0) pitchCeiling = 600 Hz (maximum expected F0) Resynthesis options: Overlap-add (higher quality) Pitch-synchronous (faster) This script uses overlap-add for best quality

DurationTier Manipulation

How DurationTier affects timing:

DurationTier defines local time scaling: Points: (time, durationFactor) durationFactor > 1.0: time stretches (slower) durationFactor < 1.0: time compresses (faster) Interpolation between points: Linear interpolation between specified points Default factor = 1.0 between defined regions Example with 3 points: (0.0, 2.0) - first second stretched to 2 seconds (1.0, 0.5) - next section compressed to half time (2.0, 1.0) -恢复正常速度 This script uses 31 points for smooth curves

Quality Considerations

Safe Parameter Ranges

Script-enforced limits:

Strength clipping: IF strength < 0.5: strength = 0.5 IF strength > 5: strength = 5 Tempo factor limits: IF durationFactor < 0.3: durationFactor = 0.3 IF durationFactor > 3.0: durationFactor = 3.0 Rationale: <0.3×: Extreme stretching causes artifacts >3.0×: Extreme compression loses information 0.3-3.0×: PSOLA works reasonably well Target duration validation: IF targetDuration ≤ 0.01: exit with error Prevents impossible processing requests

Mono Conversion

Stereo handling:

IF numberOfChannels > 1: workingSound = Convert to mono ELSE: workingSound = Copy: soundName$ + "_working" Why convert to mono? - PSOLA designed for monophonic signals - Stereo processing would require channel separation - Most applications involve mono sources (voice) - Preserves original stereo sound unchanged Processing chain: Original (possibly stereo) → Working (mono) → PSOLA → Result (mono) Original remains available for comparison

Advanced Technical Details

📊 Duration Normalization Mathematics

Continuous integral approach:

Theoretical basis: Total duration = ∫₀ᵀ durationFactor(t) dt Discrete approximation: totalDuration ≈ Σᵢ durationFactor(tᵢ) × Δtᵢ Normalization: Let meanFactor = (1/T) × ∫₀ᵀ durationFactor(t) dt Normalized curve: durationFactor_normalized(t) = durationFactor(t) / meanFactor Then: ∫₀ᵀ durationFactor_normalized(t) dt = T Implementation: 31-point Riemann sum approximation Linear interpolation between points Preserves curve shape while fixing total duration

Pitch Shift Formant Behavior:

In Mode A (pitch changes): Original formants: F₁, F₂, F₃, ... After pitch shift: αF₁, αF₂, αF₃, ... Where α = avgTempoFactor Formant ratios preserved: F₂/F₁ → (αF₂)/(αF₁) = F₂/F₁ F₃/F₁ → (αF₃)/(αF₁) = F₃/F₁ Unlike simple resampling: Resampling: F₁, F₂, F₃ preserved absolutely PSOLA+pitch: F₁, F₂, F₃ scaled equally Result: More natural vocal character

Applications

Music Production

Use case: Adding expressivity to quantized performances

Technique: Apply ritardando at phrase endings, accelerando for buildups

Settings: Pitch changes with tempo, strength 1.5-2.5, keep original duration

Film and Media Scoring

Use case: Synchronizing music with visual pacing

Technique: Use slow-fast-slow pattern for scene transitions

Settings: Pitch constant, specify target duration to match scene length

Voice Acting and Drama

Use case: Enhancing dramatic readings and storytelling

Technique: Accelerando for excitement, ritardando for emphasis

Settings: Pitch changes for vintage radio effect, strength 2.0-3.0

Audio Restoration

Use case: Correcting inconsistent tempo in old recordings

Technique: Apply inverse tempo patterns to stabilize timing

Settings: Pitch constant, mild strength (0.8-1.2)

Sound Design

Use case: Creating tension and release effects

Technique: Extreme accelerando/ritardando on sound effects

Settings: Experiment with both modes, high strength values

Practical Workflow Examples

🎹 Piano Phrase Expression

Goal: Add musical rubato to mechanical piano recording

Settings:

  • Pattern: Slow-fast-slow
  • Pitch behavior: Pitch changes with tempo
  • Strength: 2.0
  • Duration: Keep original

Result: Natural-sounding phrase shaping with authentic pitch variations

🎬 Film Scene Sync

Goal: Match music duration to specific scene length

Settings:

  • Pattern: Ritardando
  • Pitch behavior: Keep pitch constant
  • Strength: 1.5
  • Duration: Specify target duration

Result: Music naturally slows to fill required time without pitch artifacts

🎭 Dramatic Monologue

Goal: Enhance emotional impact of spoken word

Settings:

  • Pattern: Accelerando → ritardando (run twice)
  • Pitch behavior: Pitch changes with tempo
  • Strength: 2.5
  • Duration: Keep original

Result: Vintage radio drama effect with heightened expressivity

Creative Techniques

Layered processing:
  • Multiple passes: Apply different patterns sequentially
  • Sectional treatment: Process different song sections separately
  • Extreme effects: Use maximum strength for special effects
  • Combination with other effects: Add reverb, EQ after tempo processing
  • Experimental patterns: Manual editing of DurationTier for custom curves
Quality optimization:
  • Source quality: Start with clean, well-recorded audio
  • Appropriate parameters: Match pitch range to source material
  • Progressive adjustment: Make small changes and preview frequently
  • Alternative approaches: For problematic sources, try different pitch floor/ceiling
  • Final touch: Always use peak normalization (already included)

Troubleshooting Common Issues

Problem: Artifacts or glitches in output
Cause: PSOLA analysis errors, extreme parameters, or noisy source
Solution: Reduce strength, try different pitch floor/ceiling, use cleaner source
Problem: Output duration not as expected
Cause: Complex tempo curve integration, normalization issues
Solution: Check duration mode setting, use specified duration for exact control
Problem: Unnatural "chipmunk" or "robot" effect
Cause: Extreme pitch shifting or formant distortion
Solution: Use pitch constant mode, reduce strength, try different source material
Problem: Processing very slow
Cause: Long audio files, complex PSOLA analysis
Solution: Process shorter segments, use faster computer, be patient for long files

Technical Reference

Complete Parameter Reference

ParameterTypeDefaultDescription
Pattern_typeoptionmenu1Tempo variation pattern
Pitch_behavioroptionmenu1Pitch change behavior
Strengthreal2.0Intensity of tempo variation
Duration_modeoptionmenu1Duration control method
Target_durationreal5.0Desired output duration (seconds)
Play_result_when_finishedboolean1Auto-play after processing

Output Naming Convention

Automatic output naming:

Input: "mysound" Pattern 1 + Mode A: "mysound_accel_pitched" Pattern 1 + Mode B: "mysound_accel_PSOLA" Pattern 2 + Mode A: "mysound_ritard_pitched" Pattern 2 + Mode B: "mysound_ritard_PSOLA" Pattern 3 + Mode A: "mysound_slowFastSlow_pitched" Pattern 3 + Mode B: "mysound_slowFastSlow_PSOLA" Purpose: - Clear identification of processing type - Easy comparison between different settings - Prevents overwriting original - Systematic and predictable

Performance Characteristics

Processing Time Factors

Major time consumers:

1. PSOLA analysis: O(n) with audio length - Pitch tracking complexity - Pulse detection 2. DurationTier manipulation: O(1) constant - 31 points regardless of length 3. Resynthesis: O(n) with audio length - Overlap-add algorithm 4. Final scaling (if needed): O(n) with audio length - Change gender processing Typical performance: 1-minute audio: 10-20 seconds 5-minute audio: 1-2 minutes 30-minute audio: 5-10 minutes Mode A slightly slower due to pitch tier processing

Memory Usage

Storage requirements:

Major objects: Original sound: n samples × channels Working sound: n samples (mono) Manipulation: ~3× original size PitchTier: 31 points × 8 bytes DurationTier: 31 points × 8 bytes Result sound: m samples (variable duration) Peak memory ≈ 4-5× original audio size Typical usage: 1-minute mono 44.1kHz: ~10 MB original → ~50 MB peak 5-minute mono 44.1kHz: ~50 MB original → ~250 MB peak Efficient for most practical applications