Physics-Based Stereo Dynamics — User Guide

A stereo transformation in which an analytically resolved bouncing-ball simulation controls level while a prescribed horizontal path controls stereo position. The tool can use either simple lateral-position weighting or an optional geometric distance model, then mixes the processed result with the source under selectable wet/dry and output-gain policies.

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

What this does

Physics-Based Stereo Dynamics uses one selected Sound object and produces a stereo result of the same duration. Its vertical control signal comes from a ballistic point-mass model under constant gravity. Ground impacts are solved analytically within each simulation step and the outgoing velocity is scaled by a coefficient of restitution. Horizontal motion is separate: it is a user-defined linear or sinusoidal pan path, not a solved physical trajectory.

What is physically simulated — and what is not: vertical height and velocity follow ballistic motion with bounce events. Horizontal position is a prescribed control path. Consequently, presets such as Spring Oscillation and Pendulum Swing are names for musical scenarios: they use ballistic height plus sinusoidal panning, not spring or pendulum equations.

The instantaneous height/speed state is mapped to an amplitude control. That level is optionally modified either by a simple function of stereo position or by a geometric distance calculation. The resulting amplitude is split between left and right with a square-root constant-power pan law.

Key implementation points

Quick start

  1. Select exactly one Sound object in Praat.
  2. Run Physics-Based_Stereo_Dynamics.praat.
  3. For a first test, leave the default Bouncy Rubber Ball (L to R) preset.
  4. Leave Input_handling on Downmix to mono and pan (true panning) if you want the sound to move as one source.
  5. Choose the wet/dry and output-gain policy. The default is 100% wet, equal-power mix, attenuate only.
  6. Run the script. The result is named originalName_Preset_Name; the original Sound remains in the Objects list.
Named presets versus Custom: when a named preset is selected, the fields from Physics through Amplitude_scale are intentionally ignored and replaced by the preset values. Input_handling, Mix_percent, Mix_and_output_gain, Draw_visualization, and Play_result remain active for every preset.

Simulation & mapping

Vertical ballistic model

Between impacts: h(t + Δt) = h(t) + v(t)Δt − ½gΔt² v(t + Δt) = v(t) − gΔt Impact time τ inside a step is obtained from: ½gτ² − vτ − h = 0 At an impact: v_after = −v_impact × e where e is the coefficient of restitution.

The simulation nominally runs at 2000 Hz, with at least 400 states and at most 400,000 states. The final stored state is exactly at the end of the audio. Since v0.6.2 the script does not integrate one additional step beyond that endpoint, so reported bounce counts cannot include an impact occurring after the rendered sound.

Negative starting height is clamped to 0; non-positive gravity falls back to 9.8; negative restitution is clamped to 0. Restitution above 1 is allowed as a deliberate superelastic effect and is reported as non-physical. If the object begins at ground level with no upward velocity, the script stops because no motion would occur.

Prescribed horizontal path

Linear: pan(q) = start + (end − start)q Oscillating: centre = (start + end)/2 halfRange = (end − start)/2 pan(q) = centre + halfRange × sin(2π × cycles × q) where q runs from 0 to 1 over the Sound duration.

The DSP clamps the resulting pan to [-1,+1] before both the stereo pan law and the level-vs-position stage. An endpoint outside that interval is therefore a saturation request, not a virtual position beyond the loudspeakers. Since v0.6.2 the Motion Path visualization shows this same clamped position.

Physics-to-amplitude mappings

MappingAmplitude control before level-vs-position weighting
Height (control curve)h / max(h), using the measured maximum over the simulation.
Speed (control curve)|v| / max(|v|), using the measured maximum.
Height and speed, meanArithmetic mean of the two normalized control curves.
Potential energysqrt((g·h) / max(g·h)).
Kinetic energysqrt((v²/2) / max(v²/2)).
Total mechanical energysqrt((g·h + v²/2) / max(g·h + v²/2)). Since v0.6.4 the denominator is the maximum of the total energy at one simulation instant, not max(Ep)+max(Ek).

The square root in the energy mappings converts a normalized energy-like quantity into an amplitude-like control under the usual proportionality between signal energy and squared amplitude. Amplitude_scale is then applied multiplicatively.

Level versus position

Lateral weighting, louder at centre: d = |pan| gain = 1 / (1 + amount·d) Lateral weighting, louder at edges: d = |pan| gain = 1 / (1 + amount·(1 − d)) Geometric distance: x = pan × stage_half_width distance = sqrt(x² + h² + listener_distance²) distance = max(distance, reference_distance) gain = reference_distance / distance
Terminology: the first two modes are not physical distance models; they use only the absolute stereo-pan coordinate and ignore height. Only Geometric distance uses a spatial distance. Even there, the model is intentionally simple: it applies inverse-distance gain only and does not model air absorption, propagation delay, HRTF cues, room acoustics, Doppler shift, or source directivity.

Stereo pan law

p = clamp(pan, −1, +1) panNorm = (p + 1)/2 L = amplitude × sqrt(1 − panNorm) R = amplitude × sqrt(panNorm) Therefore: L² + R² = amplitude²

This is a constant-power square-root amplitude law. It mathematically preserves the sum of squared channel gains for the generated mono source. It should not be interpreted as a complete psychoacoustic localization or loudness model.

Named presets

The 15 named presets all use lateral weighting, louder at centre and the control-curve mapping family. Their values below replace the Custom block. Only Spring Oscillation and Pendulum Swing use sinusoidal panning; all other named presets use linear panning.

PresetPhysics: h0 / v0 / g / e / bouncesPanLevel amountControl mappingAmp
Bouncy Rubber Ball1.2 / 6.0 / 9.8 / 0.75 / 8−0.9 → +0.9, linear0.30Height+Speed mean1.00
Steel Ball Drop2.0 / 3.0 / 9.8 / 0.92 / 120 → 0, linear0.00Height1.20
Ping Pong Frenzy0.8 / 10.0 / 9.8 / 0.85 / 15−1 → +1, linear0.50Speed0.90
Basketball Dribble1.5 / 4.0 / 9.8 / 0.70 / 6+0.5 → +0.7, linear0.20Height+Speed mean1.10
Super Ball Chaos1.0 / 8.0 / 9.8 / 0.95 / 20−0.8 → +0.2, linear0.40Speed0.85
Dropping Stone3.0 / 0.0 / 12.0 / 0.00 / 00 → 0, linear0.00Speed1.50
Feather Falling2.0 / 1.0 / 2.0 / 0.30 / 3−0.5 → +0.5, linear0.20Height0.80
Moon Gravity1.5 / 4.0 / 1.62 / 0.65 / 8−0.8 → +0.8, linear0.20Height+Speed mean1.00
Tennis Ball1.3 / 5.5 / 9.8 / 0.73 / 7−1 → +1, linear0.60Height+Speed mean1.00
Water Skipping Stone0.5 / 12.0 / 9.8 / 0.60 / 10−0.2 → +1.5, linear; DSP clips at +10.80Speed0.75
Earthquake Tremor0.3 / 3.0 / 15.0 / 0.88 / 25−0.3 → +0.3, linear0.10Speed1.30
Heartbeat Pulse0.8 / 6.0 / 18.0 / 0.65 / 120 → 0, linear0.00Speed1.40
Spring Oscillation1.0 / 7.0 / 8.0 / 0.82 / 15−1 ↔ +1, sine, 2 cycles0.40Height+Speed mean0.95
Pendulum Swing1.8 / 2.5 / 5.0 / 0.90 / 10−1 ↔ +1, sine, 2 cycles0.70Height1.10
Rolling Downhill2.5 / 1.0 / 15.0 / 0.45 / 5−1 → +1, linear0.50Speed1.30
Preset names are compositional metaphors. They are useful starting configurations, but the script does not claim to reproduce the full mechanics or acoustics of a basketball, pendulum, rolling object, skipping stone, earthquake, or heartbeat.

Parameters

Custom-only block

ControlDefaultMeaning / behavior
Physicsh0=1.2 v0=6.0 grav=9.8 rest=0.75 bounces=8Starting height (m), vertical velocity (m/s), gravity (m/s²), restitution, and maximum bounce count. Keep the key names; order and spacing may change.
Pan_pathstart=-0.9 end=0.9 cycles=2Horizontal pan endpoints and the cycle count used only by Oscillating motion.
Pan_motionLinearLinear interpolation or sine oscillation between the endpoints.
Level_modelLateral weighting, louder at centreCentre weighting, edge weighting, or geometric distance.
Attenuation_amount0.3Non-negative strength for the lateral-weighting modes. It is not used by the geometric-distance formula.
Geometrywidth=3.0 listener=4.0 ref=1.0Stage half-width, listener distance, and reference distance in meters for Geometric distance. Invalid/non-positive values fall back to 3, 4, and 1 respectively.
MappingHeight and speed, meanSix mappings: three control curves and three energy-derived curves.
Amplitude_scale1.0Multiplicative scale after mapping and position/distance weighting. Negative values are clamped to 0.

Global controls — active for Custom and every named preset

ControlDefaultBehavior
Input_handlingDownmix to mono and panTrue point-source panning, or Preserve stereo / modulate balance. Preserve-stereo is meaningful for 2-channel input; inputs with more than two channels are forced to downmix.
Mix_percent100Wet percentage, clamped to 0–100.
Mix_and_output_gainEqual-power mix, attenuate onlySix combinations: equal-power or linear wet/dry, each paired with attenuate-only, peak-normalize, or no output gain change.
Draw_visualizationOnDraws the suite-standard diagnostic figure.
Play_resultOnPlays the generated result after processing.
Compact sentence fields: if a required key= item is missing or malformed in Custom, the script substitutes that item's default and reports the fallback in the Info window. The numeric values can be reordered or respaced; the key names themselves must remain.

Input, wet/dry mix & output gain

Input handling

Downmix to mono and pan — default

If the source has more than one channel, Praat converts it to mono. The processed mono source is duplicated into two paths and the computed left/right envelopes implement the constant-power pan. This is the appropriate mode when the physical metaphor is one moving point source.

Preserve stereo, modulate balance

For a stereo source, the left envelope multiplies the original left channel and the right envelope multiplies the original right channel. This preserves the source's channel assignment but does not make material already isolated in one channel travel through the opposite channel. It is therefore balance modulation rather than true panning. A source with more than two channels cannot use this mode and is automatically downmixed.

Wet/dry law

Equal-power mix: wet = sin(mixFraction × π/2) dry = cos(mixFraction × π/2) Linear mix: wet = mixFraction dry = 1 − mixFraction

If the dry source is mono, it is placed at stereo center with 1/√2 in each channel before mixing, rather than duplicated at full level. If Preserve stereo is active on a stereo source, its original stereo dry signal is retained.

Output gain policies

PolicyWhat it does
Attenuate onlyDefault. If the mixed peak exceeds 0.99, apply one shared gain to bring it down to 0.99. If the peak is already below 0.99, do not amplify it. This preserves meaningful differences created by Amplitude_scale and attenuation.
Peak normaliseIf the peak is nonzero, scale it to exactly 0.99. This may amplify a quiet result as well as attenuate a loud one.
No gain changeLeave the mixed level unchanged, even if the peak exceeds 1.0.

A floor of 1e-6 (−120 dB) is applied only to the left/right gain values written to the IntensityTiers so that log10 remains defined.

Visualization

The v0.6.4 visualization contains a title plus five diagnostic panels. It is intended to show what the algorithm actually computed rather than to imply a literal 3D acoustic scene.

PanelContents
A — Motion PathPan versus simulated height. The horizontal coordinate is the clamped pan used by the DSP; vertical position is ballistic height. Path color changes with time. Red ground markers are approximate sampled detections of impact states and are sized by the amplitude trace.
B — Height & SpeedHeight and absolute speed versus time, each divided by its own measured maximum.
C — Channel GainsThe computed left and right gain traces before the −120 dB tier floor. These include mapping, amplitude scale, level-vs-position weighting, and the constant-power pan law.
D — OutputFinal left and right waveforms after wet/dry mixing and the selected output-gain policy.
E — SummaryPreset/source, physical parameters, bounce count, measured maxima, simulation grid, pan mode, mapping, level model, wet percentage, mix law, gain policy, and peak before/after output gain.
Impact markers are visual diagnostics, not the authoritative bounce counter. The simulation itself resolves impacts analytically; the panel detects marker locations from the downsampled states used for drawing.

Limits & interpretation

Practical uses

The tool is well suited to experimental panning, physically inspired amplitude envelopes, rhythmic bounce structures, pedagogical demonstrations of restitution and ballistic motion, and sound-design gestures in which a simple physical model serves as a compositional controller.