Doppler Effect Simulator — User Guide
Real‑time pitch‑shift simulation of moving sound sources based on acoustic physics. Implements Doppler pitch shift and distance‑based amplitude cues for realistic spatial audio effects.
What this does
This script simulates the Doppler effect — the change in frequency (and amplitude) of a sound as its source moves relative to a listener. It applies time‑varying pitch‑shifting based on the radial velocity of the source, and optionally a distance‑based amplitude attenuation for enhanced realism. The simulation is physically accurate, using the standard acoustic Doppler formula and inverse‑square‑law amplitude scaling.
Key Features:
- Physically accurate Doppler pitch shift – Based on source speed, distance, and time of closest approach
- 5 built‑in presets – Common scenarios (car, jet, ambulance, bicycle, sci‑fi warp)
- Custom parameter control – Full manual control over speed, distance, and timing
- Amplitude distance cue – Optional inverse‑square‑law volume attenuation
- Interactive visualization – Shows source path, pitch‑shift curve, and gain curve
- PSOLA‑based pitch shifting – High‑quality, time‑domain pitch modification
Technical Implementation: (1) Pitch analysis: Extract a Pitch object from the original sound. (2) Physics loop: For each time step, compute the source’s radial velocity relative to the listener, then compute the Doppler factor f' = f * c / (c + v_radial). (3) Pitch‑tier construction: Build a PitchTier that holds the time‑varying shift factors. (4) PSOLA resynthesis: Apply the PitchTier to a Manipulation object and resynthesize the shifted sound. (5) Amplitude scaling: Optionally apply a gain curve gain = d / sqrt(d² + v²(t − t_c)²) to simulate distance attenuation. (6) Visualization: Draw the source path, pitch‑shift factor over time, and gain curve.
Quick start
- In Praat, select exactly one Sound object.
- Run script… →
Doppler_Effect_Simulator.praat. - Choose a Preset (Fast Car, Jet Flyover, etc.) or select “Custom” to enter your own values.
- Adjust Speed (m/s), Closest distance (m), and Time at closest (s) if using Custom.
- Check Apply amplitude cue to add distance‑based volume changes.
- Enable Visualize to see the motion, pitch‑shift, and gain curves.
- Click OK – the processed sound will be created as “originalname_Doppler”.
Physics & Implementation
Doppler Shift Formula
Radial Velocity Calculation
Amplitude Distance Cue
Processing Pipeline
Presets & Parameters
Built‑in Presets
| Preset | Speed (m/s) | Closest distance (m) | Description |
|---|---|---|---|
| Fast Car (City Street) | 15.0 | 4.0 | Car passing at ~50 km/h, typical street distance |
| Jet Flyover (High Altitude) | 250.0 | 100.0 | Subsonic jet at high altitude, distant rumble |
| Ambulance Passing (Close) | 20.0 | 2.0 | Emergency vehicle passing nearby, strong shift |
| Slow Bicycle | 5.0 | 1.0 | Gentle, slow pass‑by, subtle effect |
| Sci‑Fi Warp (Extreme) | 340.0 | 0.5 | Supersonic, extremely close, dramatic pitch sweep |
Custom Parameters
| Parameter | Default | Range | Description |
|---|---|---|---|
| Speed_m_s | 25.0 | 0.1 – 500 | Speed of the source in meters/second |
| Closest_distance_m | 5.0 | 0.1 – 200 | Closest distance between source and listener (meters) |
| Time_at_closest_s | 0.5 | 0 – duration | Time in the sound when the source is closest (seconds) |
| Apply_amplitude_cue | ✓ | on/off | Enable distance‑based volume attenuation |
| Normalize_output | ✓ | on/off | Normalize output peak to 0.99 (prevents clipping) |
| Visualize | ✓ | on/off | Show motion, pitch‑shift, and gain plots |
| Play | ✓ | on/off | Play the result after processing |
| Min_pitch_Hz | 75 | 50 – 200 | Minimum pitch for analysis (Hz) |
| Max_pitch_Hz | 600 | 200 – 2000 | Maximum pitch for analysis (Hz) |
- Speed: Everyday speeds are 5–30 m/s (18–108 km/h). Use 100+ m/s for aircraft, 340+ m/s for supersonic effects.
- Closest distance: 1–5 m for close pass‑by, 10–100 m for distant sources.
- Time at closest: Usually set to the middle of the sound for symmetric shift. Moving it earlier or later makes the effect asymmetric.
- Amplitude cue: Turn off for pure pitch‑shift experiments; turn on for realistic spatial simulation.
Visualization
When Visualize is enabled, the script draws a three‑panel figure showing the motion, pitch shift, and amplitude gain.
Panel 1: Spatial Schematic
• A horizontal line represents the source’s trajectory.
• A circle marks the listener’s position.
• Three colored circles show the source at start, closest point, and end.
• A dashed line indicates the closest‑approach distance.
• An arrow shows the direction of motion.
Panel 2: Pitch‑Shift Factor
• The y‑axis shows the factor by which the original pitch is multiplied.
• A dashed line at 1.0 represents no shift.
• Values >1 indicate pitch rise (approaching), values <1 indicate pitch drop (receding).
• The curve is blue and smooth, computed from the Doppler formula.
Panel 3: Amplitude Gain
• The y‑axis shows the gain factor (0 = silence, 1 = original volume at closest distance).
• The curve is red, showing how volume increases as the source approaches and decreases as it recedes.
• The peak is exactly at the time of closest approach.
Applications
Sound Design for Film & Games
Use case: Creating realistic vehicle pass‑bys, flying objects, sci‑fi effects.
Technique: Apply Doppler preset to engine, rotor, or whoosh sounds.
Example: Use “Jet Flyover” on a jet engine sample for a distant aircraft flyover.
Acoustic Education & Demonstration
Use case: Teaching the Doppler effect in physics or audio courses.
Technique: Let students adjust speed and distance, hear the change, and see the curves.
Workflow:
- Start with a pure tone (e.g., 440 Hz sine wave).
- Apply different presets to hear the pitch sweep.
- Compare the visual curves with the perceived sound.
- Discuss radial velocity and the inverse‑square law.
Experimental Music & Composition
Use case: Generating dynamic pitch‑shifts for melodic or textural variation.
Technique: Use extreme settings (“Sci‑Fi Warp”) on vocal or instrument phrases.
Example: Apply a slow, close pass‑by to a piano note to create a “bending” effect.
Audio Forensics & Analysis
Use case: Simulating vehicle motions for comparison with real recordings.
Advantages:
- Physically accurate shift.
- Reproducible parameters.
- Ability to match known speeds and distances.
Practical Workflow Examples
🚗 Realistic Car Pass‑By (Film SFX)
Goal: Convincing car passing on a street.
Settings:
- Preset: Fast Car
- Amplitude cue: ON
- Visualize: ON
- Normalize: ON
Result: Pitch rises as car approaches, peaks at closest point, falls as it recedes; volume follows inverse‑square law.
✈️ Distant Aircraft Flyover (Game Audio)
Goal: Distant jet rumble with subtle Doppler shift.
Settings:
- Preset: Jet Flyover
- Amplitude cue: ON
- Closest distance: 150 m (increase for more distance)
- Normalize: ON
Result: Gentle pitch shift with slow volume change, suitable for background ambiance.
🔬 Physics Classroom Demo
Goal: Clear demonstration of Doppler shift on a pure tone.
Settings:
- Sound: 1 kHz sine wave, 5 seconds
- Preset: Custom
- Speed: 30 m/s
- Closest distance: 3 m
- Amplitude cue: OFF (to isolate pitch effect)
- Visualize: ON
Result: Clean pitch sweep, easy to hear and see the relationship between motion and frequency shift.
Troubleshooting
Cause: PSOLA pitch‑shifting struggles with noisy or polyphonic material.
Solution: Use monophonic, harmonic sounds (voice, flute, violin). Avoid drums, noise, or full mixes.
Cause: Speed too low, distance too large, or source speed parallel to listener.
Solution: Increase speed, decrease closest distance, ensure the source moves directly toward/away from listener (radial velocity > 0).
Cause: Amplitude cue combined with very close distance leads to huge gain near closest approach.
Solution: Increase closest distance, turn off amplitude cue, or enable normalization.
Cause: “Visualize” checkbox unchecked, or Praat Picture window not available.
Solution: Check the Visualize option, ensure Praat Picture window is open.
Cause: No sound selected, or more than one sound selected.
Solution: Select exactly one Sound object before running the script.