Physics-Based Stereo Dynamics — User Guide

Spatial physical modeling: combines kinematic physics simulation with stereo panning and distance-based loudness to create immersive 3D audio effects that follow real-world physical laws.

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

What this does

This script implements physics-based stereo dynamics — an advanced audio processing system that simulates objects moving through physical space with realistic stereo positioning and distance-based loudness. Building on the kinematic physics foundation, this stereo edition adds three-dimensional spatialization: objects move left-to-right (panning), approach and recede (distance attenuation), while following realistic bounce physics. The result is immersive audio that creates the illusion of physical objects moving through the listener's environment, with amplitude, panning, and distance all governed by unified physical laws.

Key Features:

Why stereo physics? Traditional panning and spatial effects often sound artificial because they don't account for real physical behavior. Physics-based stereo adds several crucial dimensions: (1) Realistic motion: Objects follow natural trajectories with acceleration and bounce physics. (2) Distance cues: Sounds get quieter as they move away, following inverse square law principles. (3) Energy conservation: Amplitude relates to physical energy (potential and kinetic). (4) Spatial coherence: All audio parameters (volume, pan, timing) derive from unified physics. Advantages: (1) Immersive experience: Creates believable 3D audio environments. (2) Natural movement: Motion feels organic rather than synthetic. (3) Creative inspiration: Physical scenarios suggest musical applications. (4) Educational value: Demonstrates acoustics and physics principles.

Technical Implementation: (1) Dual physics simulation: Solve vertical bounce physics while computing lateral panning motion. (2) Energy mapping: Convert height and velocity to amplitude using three strategies. (3) Distance attenuation: Apply inverse-distance loudness scaling based on lateral position. (4) Stereo panning: Use square-root pan law for natural channel balancing. (5) Independent channel processing: Create separate left/right envelopes for precise stereo control. (6) Visual feedback: Plot top-down trajectories with bounce markers showing height. The system handles mono-to-stereo conversion automatically and includes robust error checking for numerical stability.

Quick start

  1. In Praat, select exactly one Sound object (mono or stereo).
  2. Run script…Physics_Based_Stereo_Dynamics.praat.
  3. Choose from 15 spatial presets in the unified dialog.
  4. For custom physics, select "Custom" and adjust parameters in the same dialog.
  5. Click Apply — physics simulation runs with progress display.
  6. View the three-panel visualization showing audio and spatial trajectory.
  7. Output named "originalname_PresetName" appears with physics-based stereo motion.
Quick tip: Start with Ping Pong Frenzy for dramatic left-right bouncing or Bouncy Rubber Ball for natural left-to-right motion. Use Earthquake Tremor for subtle stereo shaking or Spring Oscillation for smooth panning sweeps. Water Skipping Stone creates the illusion of an object moving away into the distance, while Moon Gravity produces slow, floaty spatial movement. The visualization shows the top-down trajectory with red circles indicating bounce height — larger circles mean louder sounds at that position. For musical material, try Tennis Ball for realistic court-like motion or Pendulum Swing for wide, sweeping arcs.
Important: ORIGINAL PRESERVED — your source sound remains unchanged in the Objects list. Mono inputs are automatically converted to stereo with identical left/right content before processing. Extreme pan values beyond ±1.0 are clamped to prevent numerical issues. Distance attenuation can make sounds very quiet at extreme positions — adjust the strength parameter if needed. Visualization markers show relative bounce height but may be small for low-energy bounces. Stereo imaging is maintained — the physics motion is applied to the existing stereo content. Output is normalized to prevent clipping while preserving the spatial dynamics. Test different audio material to hear how physics affects various sound types.

Stereo Physics Theory

Combined Kinematic Systems

Dimensional Motion Integration

Vertical and lateral physics unification:

VERTICAL PHYSICS (Bounce): Same as mono version: v_vertical(t) = v_vertical₀ - g × t h(t) = h₀ + v_vertical₀ × t - ½ × g × t² Bounce: v_vertical_new = -v_vertical_old × coefficient LATERAL PHYSICS (Panning): Linear motion: pan(t) = pan_start + (pan_end - pan_start) × (t / duration) Oscillatory motion (for Spring/Pendulum): pan(t) = pan_start + (pan_end - pan_start) × sin(4π × t / duration) COMBINED ENERGY MAPPING: Base amplitude from vertical physics (height/velocity/combined) Then modified by lateral position through distance attenuation SPATIAL COHERENCE: Time synchronization between vertical and lateral motion Unified physical parameters govern all aspects Consistent energy relationships throughout motion

Why Combined Physics?

Spatial realism benefits:

Distance-Based Loudness System

Inverse Distance Principles

Realistic volume attenuation:

Distance calculation: distance = |pan_position| (absolute value from center) Normalized range: 0 (center) to 1 (far left/right) Attenuation formula: dist_factor = 1.0 / (1.0 + attenuation_strength × distance) Where: attenuation_strength = user parameter (0.0-1.0) distance = absolute pan position (0-1) dist_factor = volume multiplier (1.0 at center, <1.0 at sides) Physical interpretation: Models inverse distance law: loudness ∝ 1/distance But softened to prevent extreme attenuation attenuation_strength = 0 → no distance effect attenuation_strength = 1 → strong distance effect Final amplitude: amp_final = physics_amplitude × dist_factor × amplitude_scale

Why Distance Attenuation?

Psychoacoustic realism:

🎧 Stereo Panning Intuition

Square-root pan law:

Left channel: amplitude × √(1 - pan_position)

Right channel: amplitude × √(pan_position)

Where pan_position ranges 0 (left) to 1 (right)


Why square root?

Makes center sounds seem equally loud in both speakers

Prevents amplitude buildup in the center

Psychoacoustically correct for stereo imaging

Stereo Panning Mathematics

Square-Root Pan Law

Channel amplitude calculation:

Pan position normalization: pan_norm = (pan_clamped + 1) / 2 Range: 0 (far left) to 1 (far right) Square-root pan law: amp_L = total_amplitude × √(1 - pan_norm) amp_R = total_amplitude × √(pan_norm) Energy conservation: amp_L² + amp_R² = total_amplitude² × (1 - pan_norm + pan_norm) = total_amplitude² So total power remains constant regardless of position Why this works: Prevents amplitude buildup in center Maintains consistent perceived loudness Matches how humans localize sounds Industry standard for professional audio Channel isolation: Separate IntensityTier for left and right channels Independent amplitude control for precise stereo

Why Separate Channel Processing?

Technical advantages:

Motion Trajectory Design

Preset-Specific Motion Patterns

Specialized lateral movement:

LINEAR MOTION (most presets): pan(t) = pan_start + (pan_end - pan_start) × (t / duration) Creates smooth, continuous movement OSCILLATORY MOTION (Spring, Pendulum): pan(t) = pan_start + (pan_end - pan_start) × sin(4π × t / duration) Creates back-and-forth sweeping motion 4π gives two complete cycles over the duration CONSTANT POSITION (Center-focused presets): pan(t) = 0 (or small range around center) Emphasizes vertical physics with minimal lateral motion RAPID CHANGES (Ping Pong, Chaos): Combined with many bounces for energetic spatial movement Physical consistency: Motion patterns chosen to match physical scenario Spring/Pendulum use oscillatory motion naturally Rolling/Dropping use linear motion naturally

Why Varied Motion Patterns?

Creative diversity:

Spatial Presets

🎯 Fifteen Spatial Scenarios

Carefully tuned presets combining physics with stereo motion:

Dynamic Motion Presets

PresetSpatial CharacterMotion PatternBest For
Bouncy Rubber BallNatural left-to-right bounceLinear L→R with good bouncesGeneral purpose, natural effects
Ping Pong FrenzyExtreme left-right bouncingFull stereo width, rapid motionEnergetic, attention-grabbing
Super Ball ChaosUnpredictable spatial movementAsymmetric L→R with many bouncesExperimental, glitch effects
Tennis BallCourt-like cross motionFull stereo sweep with realistic bouncesSports sounds, rhythmic material
Water Skipping StoneReceding into distanceCenter→Far right with fadingTransition effects, endings

Oscillatory & Specialized Motion

PresetSpatial CharacterMotion PatternBest For
Spring OscillationRegular left-right sweepingSinusoidal panning (2 cycles)Metallic, resonant sounds
Pendulum SwingWide, smooth arcsSinusoidal with strong distance effectAtmospheric, dramatic sweeps
Earthquake TremorSubtle stereo shakingSmall center oscillationsRumble, low-frequency effects
Rolling DownhillAccelerating left-right motionLinear L→R with building energyTension, build-up sections

Position-Focused Presets

PresetSpatial CharacterMotion PatternBest For
Steel Ball DropCentered with subtle motionMinimal panning, focus on bouncesPercussion, impact sounds
Basketball DribbleRight-side focusedSmall R-side rangeSide-panned rhythms
Dropping StonePure center impactNo lateral motionDramatic center impacts
Feather FallingGentle center→side floatSubtle L→R with light bouncesDelicate, atmospheric
Moon GravitySlow, floaty spatial motionGentle L→R with low gravitySpace, dreamlike effects
Heartbeat PulseCentered biological rhythmNo panning, focus on pulse patternOrganic, living sounds

Preset Spatial Parameters

Spatial design philosophy:
  • Realistic scenarios: Panning matches physical metaphor
  • Musical usefulness: Creates useful stereo effects
  • Listener comfort: Avoids extreme or disorienting motion
  • Creative range: Covers wide spectrum of spatial feelings

Each preset creates a distinct spatial character suitable for different audio contexts

Creative Spatial Combinations

🎵 Surround Simulation

Presets: Ping Pong Frenzy + Distance Attenuation

Application: Create pseudo-surround effects in stereo

Result: Sounds appear to move around the listener

🌊 Environmental Immersion

Presets: Water Skipping Stone + Feather Falling

Application: Process environmental and ambient sounds

Result: Natural-sounding spatial movement

⚡ Rhythmic Spatialization

Presets: Basketball Dribble + Spring Oscillation

Application: Add spatial interest to rhythmic elements

Result: Groove-enhanced stereo rhythms

Parameters Guide

⚙️ Complete Parameter Reference

Detailed explanation of all physics and spatial parameters:

Vertical Physics Parameters

ParameterRangeDefaultPhysical Meaning
Initial height0.1-10.01.2Starting height above ground (meters)
Initial velocity-20.0 to 20.06.0Starting vertical velocity (m/s)
Gravity0.1-50.09.8Vertical acceleration (m/s²)
Bounce coefficient0.0-1.00.75Energy retention per bounce
Number of bounces0-508Maximum bounce count

Lateral Spatial Parameters

ParameterRangeDefaultSpatial Meaning
Pan Start-1.0 to 1.0-0.9Starting stereo position (-1=left, +1=right)
Pan End-1.0 to 1.00.9Ending stereo position
Distance attenuation0.0-1.00.3Loudness reduction with distance

Envelope Mapping Parameters

ParameterOptionsDefaultDescription
MappingHeight, Velocity, CombinedCombinedPhysics-to-amplitude conversion
Amplitude scale0.1-3.01.0Overall amplitude multiplier

Parameter Interactions

Key spatial relationships:
  • Pan range vs motion: Wider range = more dramatic movement
  • Distance attenuation vs width: Higher = stronger center focus
  • Vertical vs lateral timing: Bounces sync with position changes
  • Gravity vs spatial rhythm: Higher gravity = faster spatial events

Parameters interact to create the overall spatial physics behavior

Recommended Custom Settings

🎸 Guitar Amp Simulation

Goal: Natural amp-in-room spatial effect

Settings:

  • Pan Start: -0.3, Pan End: 0.3
  • Distance attenuation: 0.2
  • Initial height: 0.5, Bounces: 3
  • Gravity: 8.0, Mapping: Combined

🥁 Drum Kit Panning

Goal: Realistic drum kit spatialization

Settings:

  • Pan Start: -0.8, Pan End: 0.6
  • Distance attenuation: 0.4
  • Initial height: 1.0, Bounces: 6
  • Gravity: 15.0, Mapping: Velocity

🎹 Synth Arp Movement

Goal: Smooth synthesizer arpeggio motion

Settings:

  • Pan Start: -1.0, Pan End: 1.0
  • Distance attenuation: 0.1
  • Initial height: 0.8, Bounces: 12
  • Gravity: 6.0, Mapping: Height

Applications

Music Production

Use case: Create dynamic stereo interest in mixes

Technique: Apply spatial presets to individual tracks

Example: Make synth pads move through the stereo field naturally

Sound Design

Use case: Generate immersive 3D sound effects

Technique: Use distance attenuation for depth illusion

Example: Create sounds that appear to approach and recede

Game Audio

Use case: Simulate object motion in virtual environments

Technique: Match physics parameters to game object properties

Example: Realistic ball bounce sounds with spatial tracking

Audio Post-Production

Use case: Add spatial movement to film and video sound

Technique: Use presets that match on-screen action

Example: Objects falling or moving across the screen

💡 Creative Techniques

Advanced spatial applications:

  • Layered spatialization: Different presets on different frequency bands
  • Automated motion: Change panning parameters over time
  • Hybrid approaches: Combine with reverb for room simulation
  • Rhythmic spatialization: Sync bounce timing to musical tempo

Troubleshooting Common Issues

Problem: Sound becomes too quiet
Cause: Strong distance attenuation or extreme panning
Solution: Reduce distance attenuation or increase amplitude scale
Problem: Unnatural stereo imaging
Cause: Extreme pan values or rapid motion
Solution: Use more moderate panning ranges and motion
Problem: Missing spatial motion
Cause: Identical start/end pan or zero distance effect
Solution: Increase panning range or distance attenuation
Problem: Visualization errors
Cause: Extreme physics values causing numerical issues
Solution: Use more moderate physics parameters