Advanced Stereo Panner — User Guide

A creative stereo panner with static or time-varying pan trajectories, two gain models, optional ITD, far-ear head-shadow filtering, and distance-dependent attenuation / air absorption.

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

What this does

The script converts the selected Sound to a mono working source and renders a stereo result whose left/right relationship can remain fixed or evolve over time. One RealTier acts as the master pan trajectory. The same trajectory drives channel gains, ITD, and trajectory-mode head-shadow depth, so those cues remain synchronized.

Important scope: this is not an HRTF binaural renderer. On headphones, ILD and ITD act directly between the two ears, but there is no HRTF or pinna model. On loudspeakers, acoustic crosstalk means each ear hears both speakers. The tool provides creative stereo spatial cues, not elevation or front/back localization.

Quick start

  1. Select exactly one Sound.
  2. Run Advanced_Stereo_Panner.praat.
  3. Choose Pan_mode: Static, a built-in trajectory, or Draw Your Own.
  4. Choose Panning_model. The default is Bounded psychoacoustic ILD.
  5. Enable or disable ITD, head shadow, distance and air absorption as needed.
  6. Set Peak_ceiling; 0.95 is the default.
  7. Run the script. For Draw Your Own, follow the two-pass procedure described below.
Default cue set: bounded ILD with 12 dB maximum difference, ITD up to 0.65 ms, head-shadow base cutoff 8 kHz at depth 0.5, inverse-distance model referenced to 1 m, and air-absorption reference cutoff 12 kHz.

Pan modes

ModeActual trajectoryTrajectory_cyclesTrajectory_depth
Static positionConstant pan value from a preset or Custom.IgnoredIgnored
Left to rightLinear -1 → +1.IgnoredScales excursion.
Right to leftLinear +1 → -1.IgnoredScales excursion.
Sine sweepsin(phase).Controls oscillation count.Scales excursion.
Centre out to both sidesSine oscillation multiplied by normalized time, so its width grows from 0 to full depth.Controls oscillation count.Maximum final excursion.
Sides in to centreSine oscillation multiplied by 1-u, so its width contracts to centre.Controls oscillation count.Initial excursion.
Pendulumsin(phase) × exp(-2u).Controls oscillation count.Initial excursion.
Draw your ownUser-edited RealTier.IgnoredIgnored for the drawn tier itself.

Built-in paths are sampled into a RealTier, then read onto a control grid. Values are always clipped to the legal pan range -1…+1 before processing.

Static position presets

PresetPan
Centre0
Hard Left / Hard Right-1 / +1
Medium Left / Medium Right-0.5 / +0.5
Subtle Left / Subtle Right-0.25 / +0.25
Wide Left / Wide Right-0.75 / +0.75
CustomPan_position, constrained to -1…+1

Draw Your Own — two-pass workflow

Praat cannot open another pause form while the script's own form is active, so v2.2 replaced the former waiting dialog with a persistent two-pass handshake.

PASS 1 Select the Sound only. Choose Pan mode = DRAW YOUR OWN. Run the script. → A RealTier named PanTrajectory is created and opened. → The script stops. → Edit the tier freely: -1 = hard left 0 = centre +1 = hard right PASS 2 In Objects, select BOTH: • the original Sound • the edited PanTrajectory RealTier Run the script again with DRAW YOUR OWN. → The selected RealTier becomes the master pan path. → The tier is left in place after rendering.

The initial tier is seeded with a gentle -1, -0.5, 0, +0.5, +1 sweep so the editor opens with the full pan range visible. You may edit and reuse the same RealTier for multiple renders with different spatial-cue settings.

If the selected RealTier has a different time span from the Sound, the script reports the mismatch. Outside the tier's range, Praat's nearest available tier value is used.

Panning models

1. Conventional equal-power

u = (pan + 1) / 2 gL = sqrt(1 - u) gR = sqrt(u) gL² + gR² = 1

This model already creates its own left/right level difference; no extra ILD gain is added. At hard pan the far channel reaches exactly zero. Consequently, any ITD or head-shadow processing on that silent far channel is inaudible at the endpoint.

2. Bounded psychoacoustic ILD — default

Instead of taking an equal-power pan and adding another ILD on top, the gains are solved directly from the desired inter-channel level difference.

D = pan × ILD_max_dB r = 10^(D / 20) gL = 1 / sqrt(1 + r²) gR = r / sqrt(1 + r²) gL² + gR² = 1 20 log10(gR / gL) = D

At ILD_max_dB = 12 and hard pan, the far channel remains approximately 0.2436 rather than becoming silent. This is deliberate: the far-ear ITD and head-shadow cue remain audible.

ILD_max_dB applies only to the bounded-ILD model. In conventional equal-power mode it does not alter the panning gains.

Interaural Time Difference (ITD)

The far channel is delayed by an amount proportional to pan magnitude. The output duration is always extended by the configured maximum ITD when ITD is enabled, so delayed material is not truncated.

maxItdSec = Max_ITD_ms / 1000 Left channel delay: maxItdSec × max(0, pan) Right channel delay: maxItdSec × max(0, -pan) output duration: source duration + maxItdSec

Static mode

The far ear receives one constant delay equal to |pan| × Max_ITD_ms.

Trajectory modes

The pan curve is rasterized and read per audio sample. Each channel reads the untouched source at x - delay(x). Praat interpolation therefore supplies a fractional, continuously changing delay, rather than quantizing ITD to whole samples.

Far-ear head shadow

This cue is a low-pass treatment of the far channel. It is intentionally described as head shadow, not as a complete set of spectral localization cues: there are no pinna notches, HRTFs, elevation cues, or front/back model.

Static mode — moving cutoff

far-ear cutoff = Head_shadow_cutoff_Hz × (1 - |pan| × Shadow_depth)

Only the far channel is filtered. At centre no head-shadow filter is applied.

Trajectory mode — dry/wet crossfade

A filter cutoff cannot be swept inside one Praat filter command, so moving-pan mode uses a different but explicitly reported implementation:

filtered copy = fixed low-pass at Head_shadow_cutoff_Hz far-ear wet amount = |pan(t)| × Shadow_depth dry amount = 1 - wet amount output = dry × original + wet × filtered

Shadow_depth is clamped to 0…0.95. The requested cutoff is also capped at 95% of Nyquist when necessary.

Distance & air absorption

The distance controls are global: they affect both stereo channels equally before the final safety ceiling, so they change overall level without changing the pan ratio.

Inverse distance — default

d0 = Reference_distance_meters distGain = d0 / max(distance, d0)

This is the inverse-distance pressure/amplitude law. Acoustic energy is proportional to the square of pressure, so its energy counterpart follows approximately 1/d².

Softened rolloff

distGain = 1 / (1 + 2 × distance / Max_distance)

This preserves the v1.1 curve under an accurate name. It is not an inverse-square law and is not normalized to unity at the reference distance.

Distance limits

Reference_distance_meters must be positive. If Max_distance is not above the reference it is internally raised to reference + 1 m. Distance is constrained to the interval from reference distance through maximum distance.

Air absorption

When distance and air absorption are enabled, a global low-pass becomes progressively darker from the reference distance toward Max_distance:

q = (distance - reference) / (max_distance - reference) q clipped to 0…1 airCut = Air_cutoff_at_reference_Hz / (1 + 3q)

No air filter is applied at the reference distance. The cutoff is constrained to at least 200 Hz and at most 95% of Nyquist.

Parameters

ParameterDefaultActual role
Pan_modeStaticStatic value, six generated trajectories, or Draw Your Own.
PresetCentreUsed only in Static mode.
Pan_position0Custom static pan; must be -1…+1.
Trajectory_cycles2Oscillation count for sine / widening / narrowing / pendulum paths.
Trajectory_depth1Scales built-in trajectory excursion; clamped 0…1.
Panning_modelBounded psychoacoustic ILDSelects the channel-gain law.
ILD_max_dB12 dBMaximum hard-pan difference for the bounded-ILD model.
Use_ITDonEnables far-channel delay.
Max_ITD_ms0.65 msMaximum ITD at |pan| = 1.
Use_head_shadowonEnables far-channel low-pass cue.
Head_shadow_cutoff_Hz8000 HzBase cutoff; Nyquist-capped if necessary.
Shadow_depth0.5Static cutoff depth or trajectory dry/wet depth; clamped 0…0.95.
Use_distanceonEnables global distance attenuation.
Distance_modelInverse distanceInverse-distance amplitude or legacy softened curve.
Distance_meters1 mCurrent distance, internally constrained to reference…maximum.
Max_distance_meters30 mUpper distance bound.
Reference_distance_meters1 mUnity-distance reference for inverse-distance mode.
Use_air_absorptiononEnables progressive global low-pass when distance is active.
Air_cutoff_at_reference_Hz12000 HzReference cutoff from which distance darkening is calculated.
Peak_ceiling0.95Attenuation-only output ceiling; invalid values reset to 0.95.
Draw_visualizationonDraws the v2.2.1 process figure.
Play_resultonPlays the final stereo Sound.

Output & peak ceiling

The working source is mono even when the selected input is multichannel. The left and right processed channels are combined into one stereo result named:

<source>_pan_<preset-or-trajectory-name>

Attenuation-only ceiling

if outputPeak > Peak_ceiling: safetyGain = Peak_ceiling / outputPeak L and R *= safetyGain else: safetyGain = 1 no level change

This is deliberately not peak normalization to a target. Quiet or distant results are not boosted. Consequently, distance attenuation and the absolute pan level survive into the delivered Sound.

The Info report gives the pre-ceiling peak, any common safety attenuation, final peak, actual output duration, actual maximum ITD in milliseconds/samples, distance attenuation in dB, and the ILD reached at the widest point of the path.

Visualization v2.2.1

TITLE • source • static/trajectory description • panning model • source duration and sample rate PANEL A — Spatial position • L/R speaker markers and listener • Static: one source point • Trajectory: complete horizontal path, blue start → red end • When distance is enabled, source height represents the configured distance as a schematic visual cue PANEL B — Pan over time • pan trajectory from -1 to +1 • same master path used by DSP PANEL C — Channel gains over time • blue = Left • orange = Right • includes distance attenuation • derived from the selected panning model PANEL D — Stereo output • final delivered L/R waveforms • common amplitude scale PANEL E — Summary • preset / trajectory and enabled cue set • output duration and pan range • ILD at widest point • ITD maximum • head-shadow mode • distance model and attenuation • pre/post ceiling peak and safety action
Spatial diagram: source height is a visualization of the distance parameter, not a computed loudspeaker/listener geometry. The renderer itself is stereo and contains no room model.

Implementation notes & limitations