Doppler Effect Simulator — User Guide

Straight-line moving-source Doppler processing for pitched audio, with optional inverse-distance amplitude cue, channel-preserving PSOLA resynthesis, presets, and diagnostic visualization.

Author: Shai Cohen Affiliation: Department of Music, Bar-Ilan University, Israel Version: 1.4.1 (2026) License: MIT License Repo: GitHub
Contents:

What this does

Doppler Effect Simulator applies a time-varying pitch trajectory derived from a source moving at constant speed along a straight path past a stationary listener. The user controls source speed, closest-approach distance, and the time of closest approach. A separate optional gain curve can attenuate the signal with distance.

The pitch trajectory is calculated from the classical moving-source Doppler ratio and applied with Praat Manipulation / overlap-add resynthesis. Pitch is analysed once from a mono reference; the resulting target PitchTier is then used to resynthesize every original channel independently, so the output keeps the source channel count and channel order.

Input scope: This implementation requires a usable voiced / periodic pitch contour. If pitch analysis yields no usable F0, the script stops. PSOLA is therefore most appropriate for voice, solo instruments, and other approximately monophonic pitched material.

Quick start

  1. Select exactly one Sound object in Praat.
  2. Run Doppler_Effect_Simulator.praat.
  3. Choose a preset or leave Custom.
  4. For Custom, set Speed_m_s, Closest_distance_m, and Time_at_closest_s.
  5. Choose whether to apply the distance-based amplitude cue and whether to normalize the final peak.
  6. Set the pitch-analysis range so it brackets the source F0.
  7. Enable or disable visualization and playback, then run the script.
Time_at_closest_s is measured in seconds from the beginning of the selected Sound, even when that Sound has a non-zero internal start time. Presets place the closest approach at the true midpoint of the Sound.

Motion & Doppler model

The model uses a stationary listener and a source moving at constant speed v along a straight path whose perpendicular distance from the listener is d. The source reaches its closest point at t_c.

x(t) = v · (t − t_c) r(t) = sqrt(d² + x(t)²) v_radial(t) = v · x(t) / r(t) Doppler factor(t) = c / (c + v_radial(t)) c = 343 m/s

Before closest approach, x < 0, so radial velocity is negative and the factor is above 1. After closest approach, radial velocity is positive and the factor is below 1. At the closest point the radial component is zero and the factor is 1.

Control-time geometry: audio time is mapped directly to source position. The script does not add a separate sound-propagation delay; it uses the instantaneous geometry above to generate the pitch-control trajectory.

Amplitude cue

When Apply_amplitude_cue is enabled, every sample and every channel is multiplied by:

gain(t) = d / r(t)

This is an inverse-distance amplitude/pressure cue normalized to 1 at closest approach. It is not an inverse-square amplitude law: acoustic intensity is proportional to the square of pressure, while pressure amplitude in free-field spherical spreading follows approximately 1/r.

Processing pipeline

  1. Validate: speed must be non-negative and below 343 m/s; closest distance must be positive; closest time must lie inside the Sound; pitch bounds must be ordered; Max_pitch_Hz must be below Nyquist.
  2. Mono analysis reference: multichannel input is converted to mono only for pitch analysis. Mono input is copied.
  3. Pitch analysis: Praat To Pitch uses automatic time step (0.0) and the user-supplied pitch bounds.
  4. Doppler target tier: every 10 ms, plus the exact Sound end time, the detected F0 is multiplied by the Doppler factor.
  5. Sampling-safe target limit: target F0 values are limited to 20 Hz … 0.45 × sample rate. The Info window reports how many control points were limited.
  6. Per-channel resynthesis: each original channel gets its own Manipulation object, receives the same target PitchTier, and is resynthesized with overlap-add.
  7. Recombine: resynthesized channels are combined in source channel order.
  8. Amplitude cue: if enabled, the d/r gain curve is applied identically to all channels.
  9. Normalization: if enabled and the result is non-silent, Scale peak: 0.99 performs target peak normalization.

Presets

Presets replace only the three motion parameters: speed, closest distance, and closest time. They do not override amplitude cue, normalization, visualization, playback, or pitch-analysis bounds.

PresetSpeedClosest distanceClosest time
Fast Car (City Street)15 m/s4 mSound midpoint
Jet Flyover (High Altitude)250 m/s100 mSound midpoint
Ambulance Passing (Close)20 m/s2 mSound midpoint
Slow Bicycle5 m/s1 mSound midpoint
Sci-Fi Warp (Extreme)340 m/s0.5 mSound midpoint
Sci-Fi Warp is an intentionally extreme near-sonic preset. The script rejects speeds at or above 343 m/s, so the model remains within its enforced subsonic range.

Parameters

ParameterDefaultMeaning
PresetCustomSelect Custom or one of five motion presets.
Speed_m_s25.0Constant source speed in m/s. Must satisfy 0 ≤ speed < 343.
Closest_distance_m5.0Perpendicular source-listener separation at closest approach; must be greater than 0.
Time_at_closest_s0.5Seconds from Sound start to closest approach; must lie within the Sound duration.
Apply_amplitude_cueYesApply the normalized inverse-distance gain d/r.
Normalize_outputYesTarget-normalize a non-silent final result to peak 0.99.
VisualizeYesDraw the spatial schematic, Doppler-factor curve, gain curve, and summary.
PlayYesPlay the final Sound after processing.
Min_pitch_Hz75Lower bound for Praat pitch analysis.
Max_pitch_Hz600Upper bound for Praat pitch analysis; must also be below Nyquist.

Channels & output

Visualization

When Visualize is enabled, the Picture window contains three diagnostic panels plus text summaries.

Spatial schematic

The top panel shows start, closest approach, end, listener position, direction of motion, and the closest-distance marker. Its horizontal coordinate is the Sound's time axis; it is a schematic of the pass-by sequence, not a spatial plot in meters.

Doppler factor

The middle panel plots c/(c + v_radial). A dashed line at 1 marks no pitch shift. Values above 1 occur while approaching and values below 1 while receding.

Gain

The lower panel plots the theoretical d/r gain trajectory with a maximum of 1 at closest approach. This diagnostic curve is drawn even when Apply_amplitude_cue is disabled; in that case it shows the available distance cue rather than an applied amplitude transformation.

Summary

The figure also reports the preset, speed, closest distance, expected approach/recede shift, and a compact summary strip. Detailed run parameters and any sampling-safety pitch limiting are reported in the Info window.