BPM Surround Panning — User Guide
8-channel immersive audio spatialization: creates mathematical motion patterns (orbits, spirals, swarms) in 7.1 surround sound by applying time-varying amplitude envelopes across speaker channels for experimental spatial composition.
What this does
This script implements algorithmic surround sound spatialization — a mathematical approach to creating immersive 3D audio experiences using parametric motion patterns. Takes mono or stereo source audio, distributes it across 8 channels (7.1 surround: FL, FR, C, LFE, SL, SR, BL, BR), applies time-varying amplitude envelopes to each channel based on chosen spatial pattern. Process creates perceived movement: sound source appears to orbit, spiral, bounce, or swarm through listening space. Mathematical formulas control spatial trajectories: trigonometric functions (sine/cosine) for circular motion, modulo operations for bouncing, Lissajous curves for figure-8 patterns, composite sine waves for chaotic swarm behavior. Result: spatially-animated audio where listener perceives sound moving through 3D space according to algorithmic patterns rather than static positioning or manual automation.
Key Features:
- 15 Spatial Patterns — Circle, Figure-8, Spiral, Bounce, Swarm, Tornado, Wave, Plasma, Neural, Quantum, DNA, Galaxy, Lightning, Heartbeat, Breathing
- 7 Speed Presets — From 1 cycle (very slow) to 64 cycles (very fast) per file duration
- 8-Channel Output — Full 7.1 surround sound speaker layout
- Binaural Downmix — Automatic headphone-compatible stereo preview
- Mathematical Control — Parametric equations define precise spatial trajectories
- Experimental Flexibility — Patterns range from geometric (circle, spiral) to organic (swarm, breathing)
Technical Implementation: (1) Input processing: Accepts mono or stereo source, converts stereo to mono for spatialization base. (2) Channel duplication: Creates 8 independent copies of mono source (one per speaker). (3) Pattern application: For each spatial pattern, unique amplitude envelope formula applied to each channel: Time variable x = sample position in seconds, Base rate = cycles_per_file / duration (movement frequency in Hz), Channel formulas use trigonometric functions with phase offsets: FL, FR phase offset ±π/4 (front quadrants), SL, SR phase offset ±π/2 (side positions), BL, BR phase offset ±3π/4 (back quadrants), C phase offset 0 (center reference), LFE constant or low-frequency modulation (subwoofer), Floor minimum 0.05 (5% prevents complete silence), modulation depth typically 0.45 (45% variation around 50% baseline). (4) Output creation: 8 individual channel files (mono WAV-compatible), Stereo preview (FL + FR for basic listening), Binaural downmix (HRTF-approximated headphone version). (5) Mathematical mapping: Circular patterns: cos(ωt + φ) where ω = 2π × base_rate, φ = channel-specific phase, Spiral patterns: radius(t) × cos(ωt + φ) where radius varies sinusoidally, Figure-8: parametric Lissajous curves with 2:1 frequency ratios, Bounce: absolute value of modulo operations (sawtooth reflection), Swarm: sum of multiple inharmonic sine waves (chaotic but deterministic).
Quick start
- In Praat, select exactly one Sound object (mono or stereo).
- Run script… →
BPM_SURROUND__Panning.praat. - Choose Cycles_Per_File: Number of complete spatial cycles (1 = very slow, 64 = very fast).
- Choose Spatial_Pattern: Select from 15 algorithmic motion patterns.
- Click OK — script processes audio and creates 8 channel files.
- Review Info window for processing details and channel layout.
- Listen to stereo_preview (FL + FR channels) or binaural_headphone_mix for spatial effect.
- Export individual channels for DAW assembly into true 7.1 surround file.
Spatialization Theory
Amplitude-Based Panning Fundamentals
Vector Base Amplitude Panning (VBAP) Principles
Spatial audio through amplitude distribution:
7.1 Surround Speaker Layout
ITU-R BS.775 standard speaker positions:
Mathematical Pattern Generation
Parametric Motion Equations
Spatial trajectories via mathematical functions:
Frequency and Cycle Calculation
Movement rate determination:
Speed Parameters
Base rate formula:Amplitude Modulation Depth
Dynamic Range Control
Channel gain formula structure:
Spatial Patterns
Geometric Patterns (Predictable, Mathematical)
1. Circle (Clockwise Orbit)
Description: Uniform circular motion around listener at constant radius. Sound source travels through each speaker position sequentially: FL → FR → SR → BR → BL → SL → FL. Classic panning effect, predictable trajectory.
Formula: g_i(t) = 0.5 + 0.45 × cos(2πft + φ_i) where φ_i = speaker angular position
Applications: Traditional surround panning, cinematic flyby effects, rotating soundscapes, testing speaker setup, demonstrating basic spatialization.
Best speed: 2-8 cycles for clear circular perception, 16+ cycles for energetic whirl.
2. Figure-8 (Infinity Loop)
Description: Lissajous curve creating figure-8 (∞) trajectory. Sound crosses through center twice per cycle, creating front-back and left-right motion pattern. Non-circular path adds complexity.
Formula: g(t) = 0.5 + 0.4 × sin(2πft) × cos(4πft) (parametric 2:1 frequency ratio)
Applications: Abstract spatial patterns, musical phrasing (wave-like motion), psychoacoustic experiments, decorative panning.
Best speed: 1-4 cycles to appreciate infinity pattern, 8+ cycles for faster crossing motion.
3. Spiral (Inward/Outward)
Description: Circular motion with time-varying radius. Sound orbits while moving closer/farther from listener. Radius modulates sinusoidally (expanding/contracting) while rotating. Adds depth dimension.
Formula: radius = 0.3 + 0.2 × sin(0.5πft), g_i(t) = 0.5 + radius × cos(4πft + φ_i)
Applications: Dramatic spatial crescendos, approach/departure effects, 3D motion simulation, vortex-like sounds.
Best speed: 4-16 cycles for spiral perception, slower = hypnotic, faster = dizzying.
4. Bounce (Wall Collision)
Description: Ricocheting motion as if sound bouncing off invisible walls. Uses modulo operations with absolute value to create sawtooth reflection. Unpredictable caroming trajectory.
Formula: x = |((4ft) mod 4) - 2| - 1, y = |((3ft) mod 6) - 3| - 1.5
Applications: Game audio (projectile sounds), percussive spatialization, chaotic motion aesthetics, soundscape animation.
Best speed: 8-32 cycles for rapid bounce sensation, 1-4 cycles for slow drift with collisions.
Organic Patterns (Natural, Complex)
5. Swarm (Collective Intelligence)
Description: Chaotic but organized movement mimicking bee swarm or flock behavior. Multiple inharmonic sine waves (7 and 3 Hz, 5 and 11 Hz) create quasi-random motion with underlying coherence. High complexity.
Formula: g(t) = 0.5 + 0.25×sin(7πft)×sin(3πft) + 0.15×sin(5πft)×sin(11πft)
Applications: Insect swarms, crowd ambiences, generative music, algorithmic composition, organic soundscapes.
Best speed: 4-16 cycles for chaotic buzz, 1-2 cycles for slow drift.
6. Tornado (Vortex Motion)
Description: 3D vortex with vertical component. Rapid rotation (6× base rate) combined with vertical oscillation. Front speakers modulated by +height, rear by -height. Creates funnel effect.
Formula: height = sin(πft), g_i(t) = 0.5 + 0.35×cos(6πft + φ_i)×(0.7 ± 0.3×height)
Applications: Storm sounds, industrial drones, sci-fi effects, immersive atmospheres, cyclonic motion.
Best speed: 4-8 cycles for dramatic vortex, 16+ cycles for violent spinning.
7. Wave (Ocean Current)
Description: Lateral wave motion traveling left-to-right or front-to-back. Sinusoidal traveling wave with phase propagation. Creates impression of passing wave crests.
Applications: Water sounds, ambient waves, phasing effects, lateral sweeps, oceanic atmospheres.
Best speed: 1-4 cycles for slow ocean waves, 8-16 cycles for choppy seas.
8. Plasma (Energy Field)
Description: High-frequency chaotic modulation simulating plasma turbulence. Multiple fast oscillations create shimmering, unstable spatial field. Electrical aesthetic.
Applications: Sci-fi energy fields, electrical disturbances, glitch aesthetics, unstable space, synthesizer sweeps.
Best speed: 16-64 cycles for plasma shimmer, 4-8 cycles for slower field fluctuations.
Conceptual Patterns (Abstract, Experimental)
9. Neural (Brain Network)
Description: Irregular firing pattern mimicking neural network activity. Sparse, stochastic-like modulation with bursts and quiet periods. Pseudo-random via complex sine combinations.
Applications: Brain-inspired generative music, cognitive soundscapes, consciousness themes, electroacoustic composition.
Best speed: 8-32 cycles for neuron-like firing, 1-4 cycles for slow network waves.
10. Quantum (Probability Cloud)
Description: Uncertain, non-deterministic-appearing motion. High-frequency jitter overlaid on base motion. Evokes quantum indeterminacy through rapid position fluctuations.
Applications: Quantum physics sonification, uncertainty themes, jittery spatial effects, philosophical audio art.
Best speed: 16-64 cycles for quantum uncertainty, 4-8 cycles for slower probability clouds.
11. DNA (Helix in 3D Space)
Description: Double helix trajectory. Two intertwined spirals with 180° phase offset. Creates twisted ladder pattern through space. Biomorphic motion.
Applications: Biological themes, genetic music, intertwined melodies, helical motion, science visualization.
Best speed: 2-8 cycles to perceive helix structure, 16+ cycles for rapid twisting.
12. Galaxy (Stellar Motion)
Description: Spiral arms with differential rotation. Inner regions faster rotation than outer. Simulates galactic disk motion. Astrophysical aesthetic.
Applications: Space themes, cosmic ambiences, astronomical music, long-duration drones, sci-fi soundscapes.
Best speed: 1-4 cycles for majestic slow rotation, 8-16 cycles for faster stellar orbits.
13. Lightning (Electrical Discharge)
Description: Sudden, unpredictable spatial jumps with long silences. Staccato bursts that "jump" between speakers. High contrast, sparse activity. Electric aesthetic.
Applications: Thunder/lightning, electrical glitches, percussive spatial accents, surprise elements, sparse textures.
Best speed: 4-16 cycles for storm-like strikes, 1-2 cycles for rare, dramatic zaps.
14. Heartbeat (Pulse Expansion)
Description: Rhythmic expansion/contraction from center. Pumping motion radiating outward then collapsing inward. Lub-dub rhythm with spatial dynamics. Biological pulsation.
Applications: Heartbeat sounds, rhythmic drones, pulse-based music, physiological themes, tension/release dynamics.
Best speed: 1-2 cycles for slow heartbeat (60 BPM equivalent), 4-8 cycles for elevated heart rate.
15. Breathing (Lung Expansion)
Description: Slow inhale/exhale spatial cycle. Gradual expansion during inhale (sound spreads to all speakers), contraction during exhale (sound focuses to center). Meditative quality.
Applications: Breath sounds, ambient meditation, yoga/wellness audio, physiological synchronization, calm atmospheres.
Best speed: 1-2 cycles for natural breathing rate (4-8 breaths/minute), 4 cycles for hyperventilation effect.
Parameters & Configuration
Script Parameters
| Parameter | Type | Values | Description |
|---|---|---|---|
| Cycles_Per_File | Choice | 1, 2, 4, 8, 16, 32, 64 | Number of complete spatial cycles over file duration. Determines movement speed: base_rate = cycles / duration (Hz). Lower = slower, more dramatic; higher = faster, more energetic. |
| Spatial_Pattern | Choice | 15 options | Algorithmic motion pattern: Circle, Figure-8, Spiral, Bounce, Swarm, Tornado, Wave, Plasma, Neural, Quantum, DNA, Galaxy, Lightning, Heartbeat, Breathing. Each uses unique mathematical formula. |
Output Files
| Output Object | Channels | Description | Use Case |
|---|---|---|---|
| channel_1_FL | Mono | Front Left speaker channel | Export for DAW 7.1 assembly |
| channel_2_FR | Mono | Front Right speaker channel | Export for DAW 7.1 assembly |
| channel_3_C | Mono | Center speaker channel | Export for DAW 7.1 assembly |
| channel_4_LFE | Mono | Low Frequency Effects (subwoofer) | Export for DAW 7.1 assembly |
| channel_5_SL | Mono | Surround Left speaker channel | Export for DAW 7.1 assembly |
| channel_6_SR | Mono | Surround Right speaker channel | Export for DAW 7.1 assembly |
| channel_7_BL | Mono | Back Left speaker channel | Export for DAW 7.1 assembly |
| channel_8_BR | Mono | Back Right speaker channel | Export for DAW 7.1 assembly |
| stereo_preview | Stereo | FL + FR only (limited spatial impression) | Quick audition in Praat (auto-plays) |
| binaural_headphone_mix | Stereo | HRTF-approximated downmix for headphones | Better spatial perception on headphones |
Cycle Speed Guidelines
Choosing Appropriate Speed
Speed affects spatial perception and musical character:
- 1 cycle (very slow): Entire file = one spatial movement. Best for: Long drones (60+ seconds), cinematic sweeps, meditation music, subtle spatial animation. Perception: Glacial, almost static, requires attention to notice.
- 2 cycles: Moderate speed for mid-length files (20-40 seconds). Best for: Ambient music, soundscapes, slow orbits, contemplative pieces. Perception: Deliberate, noticeable without being obvious.
- 4 cycles: Default/balanced speed. Best for: General use, testing patterns, experimental music, moderate file lengths (10-30 seconds). Perception: Clear spatial movement, engaging without overwhelming.
- 8 cycles (medium): Faster motion becomes prominent feature. Best for: Rhythmic music, energetic passages, short files (5-15 seconds). Perception: Active, animated, draws attention to spatialization.
- 16 cycles: Rapid motion, verging on effect. Best for: Builds/transitions, high-energy sections, special effects, glitch aesthetics. Perception: Aggressive, spinning, potentially disorienting.
- 32 cycles (fast): Very fast, almost tremolo-like spatial modulation. Best for: Sound design, synthesizer patches, micro-variations, granular effects. Perception: Blur of motion, shimmer, less discrete position changes.
- 64 cycles (very fast): Extreme speed approaching audio-rate modulation. Best for: Textural effects, spatial phasing, AM-like sidebands, experimental extremes. Perception: Timbral coloration more than spatial movement.
Formula for tempo-sync: If matching to musical tempo (BPM), calculate: cycles = (duration × BPM) / 60 for one rotation per beat, or divide by measures for slower sync.
DAW Integration Workflow
- Export individual channels: In Praat Objects window, select each channel (channel_1_FL through channel_8_BR), Save → Save as WAV file. Name consistently: "projectname_FL.wav", "projectname_FR.wav", etc.
- Import to DAW: Open project in DAW with multichannel support (Reaper, Logic Pro, Pro Tools, Nuendo). Create 8 mono tracks or 1 multichannel track (7.1 configuration).
- Assign channel routing: Route each imported file to correct 7.1 channel: Track 1 → FL (front left), Track 2 → FR (front right), Track 3 → C (center), Track 4 → LFE (subwoofer), Track 5 → SL (surround left), Track 6 → SR (surround right), Track 7 → BL (back left), Track 8 → BR (back right).
- Verify alignment: All channels should align at 0:00 (confirm no sync issues). Check waveforms for expected spatial patterns.
- Monitor/adjust: Use surround panner visualization to verify spatial movement. Adjust individual channel levels if needed (typically not required).
- Export multichannel: Render as multichannel WAV or interleaved file format (8-channel interleaved WAV). Or: Export stem files for flexibility in final mixing.
Alternative workflow: For binaural-only output, use binaural_headphone_mix directly (no DAW required). This provides stereo file with spatial impression for headphone listening.
Applications
Compositional Uses
Experimental Music
Use case: Algorithmic spatial composition where mathematical patterns drive musical structure. Spatial trajectory as compositional parameter equal to pitch/rhythm/timbre.
Techniques:
- Sync spatial cycles to musical form (1 cycle = 1 phrase/section)
- Use different patterns for contrasting sections (Circle for A section, Swarm for B section)
- Layer multiple sources with different spatial patterns (heterophonic spatialization)
- Match pattern character to musical content (Breathing for quiet passages, Tornado for climaxes)
Example workflow: Take 60-second ambient drone. Apply Spiral pattern (4 cycles) to base drone, Figure-8 (8 cycles) to high harmonics, Heartbeat (2 cycles) to low pulse. Result: multi-layered spatial counterpoint.
Sound Art Installations
Use case: Gallery/museum installations with multichannel speaker arrays. Algorithmic spatialization creates autonomous, evolving soundscapes.
Installation setup: Position 8 speakers per 7.1 layout (or adapt to available speakers). Run continuous loop of spatialized audio. Visitors experience immersive spatial movement as they enter space.
Pattern selection:
- Slow patterns (1-2 cycles over 10+ minutes) for meditative installations
- Organic patterns (Swarm, Breathing) for biomorphic themes
- Geometric patterns (Circle, Spiral) for minimalist/mathematical aesthetics
- Complex patterns (Quantum, Neural) for science/technology exhibitions
Electroacoustic Composition
Use case: Acousmatic music where spatial movement integral to compositional discourse. Praat-generated spatialization provides precise, reproducible spatial gestures.
Integration with other processing: Combine BPM Surround Panning with other Praat AudioTools scripts: (1) Apply pitch shifting or time-stretching first, (2) Add spatialization as final stage, (3) Export 8 channels for mixing with traditionally-panned elements in DAW.
Spatial dramaturgy: Use spatial pattern changes as formal articulation. Example: Static center positioning → gentle Circle → aggressive Bounce → return to center = tension arc.
Research Applications
Example experiments:
- Spatial localization accuracy: Does speed (cycles_per_file) affect ability to track moving source?
- Pattern complexity perception: Can listeners distinguish Circle vs Spiral vs Figure-8?
- Aesthetic preference: Rating 15 patterns for pleasantness/engagement
- Attention capture: Do certain patterns (Lightning, Swarm) draw more attention than others (Circle, Breathing)?
Creative Sound Design
Game Audio Prototyping
Use case: Rapidly prototype spatial behaviors for moving sound sources in games (flying enemies, orbiting projectiles, environmental effects).
Workflow: (1) Select pattern matching desired behavior (Circle for orbiting drone, Bounce for ricocheting bullet), (2) Adjust speed to match gameplay tempo, (3) Export 8 channels or binaural mix, (4) Import to game engine for testing, (5) Refine parameters based on playtest feedback.
Pattern matching: Swarm → buzzing insects; Tornado → whirlwind attack; Lightning → teleporting enemy; Galaxy → asteroid field; Breathing → ambient wind cycles.
Film/Video Post-Production
Use case: Create spatial effects for surround mixes (especially experimental/abstract films, sci-fi, horror).
Advantages over manual panning: Mathematically perfect trajectories (no human hand wobble), instant speed changes via parameter, reproducible for alternate takes, complex patterns difficult to draw by hand (Swarm, Quantum).
Practical application: UFO flyover = Circle pattern (8 cycles over 5 seconds); ghostly presence = Quantum or Neural pattern (creates uncertainty); nightmare sequence = Tornado or Plasma (disorienting); cosmic vista = Galaxy pattern (slow, majestic 1-2 cycles).
Educational Uses
Classroom activities: Predict spatial trajectory from formula before listening; Sketch spatial path after listening (then verify with known pattern); Compare binaural mix vs stereo preview (discuss HRTF); Match pattern to visual animations (synesthetic integration).
Technical Considerations
Praat Limitations
Praat cannot create true multichannel audio files (>2 channels). Script produces 8 separate mono files requiring external combination in DAW. This is fundamental Praat limitation, not script deficiency.
Spatial pattern application uses Formula command on each channel (8 formula evaluations). For long files (>5 minutes), processing may take 10-30 seconds per channel. Total script runtime: typically under 5 minutes for standard audio durations.
Binaural Mix Approximation
LFE Channel Behavior
Amplitude Floor Considerations
Why max(0.05, ...) Floor?
Prevents complete channel silence during spatial movement. Without floor, channels would reach 0 amplitude when source far from that speaker → creates "holes" in spatial image where audio disappears. With 5% floor, sound always audible from all speakers (though very quiet when source distant) → maintains continuity and spatial envelope.
Perceptual trade-off: Reduces maximum spatial contrast (90% range vs potential 100%), but significantly improves listening experience for continuous spatial trajectories. For discrete/jump patterns (Lightning), lower floor (0.01) or no floor may be appropriate.
Adjusting floor in script: Change max(0.05, ...) to max(0.0, ...) for full range with silence, or max(0.2, ...) for more conservative 20% minimum (subtler spatial effect).
Troubleshooting
Common Issues
Possible causes: (1) Using stereo_preview which only plays FL + FR (limited spatial impression), (2) Speed too slow (1 cycle over long file = subtle), (3) Monitoring in stereo instead of surround
Solutions: Switch to binaural_headphone_mix for headphone listening; Increase cycles (try 8-16 for more obvious motion); Export 8 channels to DAW and monitor in actual surround; Try more dramatic pattern (Bounce, Swarm vs subtle Circle)
Cause: Should not occur — all channels derived from same source with simultaneous formula application
Solution: If detected in DAW, verify you exported all channels from same script run (don't mix channels from different runs); Check DAW import settings (sample rate matching); Re-run script and re-export all channels
Cause: Source audio already near 0dB, spatial modulation amplitudes (up to 0.95) may push over threshold
Solution: Normalize source audio to -6dB or -3dB before running script; Reduce amplitude in formula (change 0.45 depth to 0.35); Apply gain reduction in DAW post-spatialize
Cause: LFE constant amplitude (typically 0.3-0.4) may not match source content
Solution: Adjust LFE gain in DAW after export; Modify LFE formula in script (line ~128, 150, 172, etc.) — change 0.3 to 0.1 (quieter) or 0.5 (louder); Low-pass filter LFE in DAW to <120 Hz for proper subwoofer content
Cause: Script automatically converts stereo to mono (line 61-64) for spatialization
Solution: This is intended behavior — spatialization treats source as point source. If you want stereo preserved: (1) Separate L/R channels manually, (2) Run script on each channel separately, (3) Combine results creating 16-channel output (2 independent 7.1 streams), OR use external stereo-to-surround upmixer before spatialization