Harmonic Spray / Partial Panner — User Guide
Spectral stereo imaging: pans different frequency bands across the stereo field for enhanced width and spatial distribution.
What this does
This script implements harmonic spray / partial panning — a sophisticated spectral stereo imaging technique that distributes different frequency bands across the stereo field. The process: (1) Frequency analysis: Split audio into logarithmically-spaced frequency bands, (2) Spatial mapping: Assign each band to stereo positions based on frequency, (3) Panning application: Apply constant-power panning to each band, (4) Recombination: Sum all panned bands into stereo output. Result: mono sounds transformed into rich stereo images with frequency-dependent spatial distribution.
Key Features:
- 6 Intelligent Presets — From subtle to extreme spatial effects
- Enhanced Algorithms — Q-based bandwidth, S-curve mapping, frequency-dependent panning
- Mono Compatibility — Bass frequency protection for stable center image
- Constant Power Panning — Maintains perceived loudness across stereo field
- Dry/Wet Control — Flexible mixing of processed and original signals
- Psychoacoustic Optimization — Perceptually-informed frequency handling
Technical Implementation: (1) Band splitting: Hann bandpass filters with proportional Q values. (2) Spatial mapping: S-curve distribution through tanh function. (3) Pan law application: Constant-power cosine/sine panning. (4) Frequency weighting: Reduced panning for bass, full panning for treble. (5) Mono protection: User-defined LF cutoff. (6) Level compensation: -3.5dB master trim. (7) Dry/wet mixing: Flexible blend control. Key insight: Frequency → stereo position mapping creates spectral width while maintaining mono compatibility.
Quick start
- In Praat, select exactly one Sound object (mono or stereo).
- Run script… →
harmonic_spray.praat. - Choose preset: Standard Spread for general use, Subtle Widening for gentle effect.
- Adjust dry/wet mix (1.0 = fully processed, 0.5 = 50/50 blend).
- For custom control: modify band count, pan width, bandwidth, and LF protection.
- Click OK — processes audio, creates "originalname_spray" stereo output.
Spectral Panning Theory
Frequency-Dependent Localization
Human Hearing and Stereo Perception
Psychoacoustic principles:
Logarithmic Frequency Scaling
Perceptual frequency distribution:
Constant Power Panning
Pan Law Mathematics
Maintaining perceived loudness:
-3.5dB Compensation
Why master trim is needed:
Complete Processing Pipeline
Preset Configurations
Preset 1: Custom
⚙️ Full Parameter Control
Bands: User specified (default: 8)
Pan Width: User specified (default: 0.8)
Bandwidth: User specified (default: 0.5 octaves)
Character: Fully customizable spectral distribution
Best for: Experimental work, specific frequency targeting
Preset 2: Subtle Widening
🎵 Gentle Stereo Enhancement
Bands: 6 (moderate resolution)
Pan Width: 0.5 (50% maximum spread)
Bandwidth: 0.5 octaves (balanced selectivity)
Character: Natural, unobtrusive width enhancement
Best for: Main vocals, acoustic instruments, delicate material
Preset 3: Standard Spread
🎛️ General Purpose Stereo
Bands: 8 (good resolution)
Pan Width: 0.8 (80% maximum spread)
Bandwidth: 0.5 octaves (balanced selectivity)
Character: Noticeable but natural stereo enhancement
Best for: Most musical material, mixes, general audio
Preset 4: Extreme Spray
🔥 Maximum Spectral Separation
Bands: 16 (high resolution)
Pan Width: 1.0 (full left/right spread)
Bandwidth: 0.33 octaves (narrow, selective)
Character: Dramatic, very wide, potentially artificial
Best for: Special effects, synthetic sounds, experimental
Preset 5: Reverse (High→L / Low→R)
🔄 Inverted Spectral Distribution
Bands: 10 (good resolution)
Pan Width: -0.9 (reverse direction, 90% spread)
Bandwidth: 0.5 octaves (balanced selectivity)
Character: Unusual, inside-out, attention-grabbing
Best for: Creative effects, surreal textures, standout elements
Preset 6: Dense Shimmer
✨ High-Frequency Sparkle
Bands: 20 (very high resolution)
Pan Width: 0.7 (70% spread)
Bandwidth: 0.33 octaves (narrow, detailed)
Character: Detailed, sparkling, complex high-end
Best for: Hi-hats, cymbals, bright synths, atmospheric textures
Preset 7: Coarse Texture
🎪 Bold Frequency Blocks
Bands: 4 (low resolution)
Pan Width: 1.0 (full spread)
Bandwidth: 1.0 octaves (wide, overlapping)
Character: Bold, blocky, obvious frequency separation
Best for: Lo-fi effects, aggressive textures, rhythmic material
Preset Visualization
Subtle Widening: L ←···C···→ R (gentle spread)
Standard Spread: L ←····C····→ R (balanced)
Extreme Spray: L············R (full separation)
Reverse: R ←····C····→ L (inverted)
Dense Shimmer: L·↑·↑·↑·↑·↑·R (detailed highs)
Coarse Texture: L██▌C▐██R (blocky bands)
Note: All presets maintain bass frequencies near center
Technical Enhancements
Enhancement 1: Q-Based Proportional Bandwidth
🎚️ Constant-Q Filtering
Principle: Bandwidth proportional to center frequency
Implementation: Fractional octave bandwidth maintained across spectrum
Benefit: Perceptually consistent frequency resolution
Formula: freq_low = center/√(2^octave), freq_high = center×√(2^octave)
Bandwidth Comparison
Center 100 Hz: 84-119 Hz (35 Hz wide)
Center 1000 Hz: 841-1189 Hz (348 Hz wide)
Center 5000 Hz: 4204-5946 Hz (1742 Hz wide)
Constant absolute bandwidth (for comparison):
Center 100 Hz: 75-125 Hz (50 Hz wide)
Center 1000 Hz: 975-1025 Hz (50 Hz wide) ← Too narrow at high frequencies!
Center 5000 Hz: 4975-5025 Hz (50 Hz wide) ← Much too narrow!
Proportional bandwidth matches human frequency resolution
Enhancement 2: Frequency-Dependent Pan Width
🎛️ Adaptive Spatial Scaling
Principle: Less panning at low frequencies, more at high frequencies
Implementation: Scaling curve: 0.3 (bass) → 1.0 (treble)
Benefit: Natural localization matching human perception
Formula: scale = 0.3 + 0.7 × (log_freq)^0.7
Enhancement 3: S-Curve Spatial Mapping
📈 Perceptually Smooth Distribution
Principle: Non-linear mapping for smoother frequency transitions
Implementation: tanh(2.5×(2×pos-1)) S-curve function
Benefit: Avoids abrupt panning changes between adjacent bands
Visual: Gentle curves instead of linear steps
S-Curve vs Linear Mapping
Band 1: L····· (position -1.0)
Band 2: ·L···· (position -0.71)
Band 3: ··L··· (position -0.43)
Band 4: ···C·· (position -0.14)
Band 5: ····R· (position +0.14)
Band 6: ·····R (position +0.43)
Band 7: ·····R (position +0.71)
Band 8: ·····R (position +1.0)
S-curve mapping (8 bands):
Band 1: L····· (position -1.0)
Band 2: L····· (position -0.96)
Band 3: ·L···· (position -0.70)
Band 4: ··C··· (position -0.10)
Band 5: ···C·· (position +0.10)
Band 6: ····R· (position +0.70)
Band 7: ·····R (position +0.96)
Band 8: ·····R (position +1.0)
S-curve: more center clustering, smoother transitions
Enhancement 4: Mono-Safe Bass Protection
🔊 Low Frequency Stability
Principle: Bass frequencies kept near center for mono compatibility
Implementation: User-defined cutoff with gradual transition
Benefit: Prevents phase cancellation in mono playback
Formula: scale = (freq/cutoff)² for freq < cutoff
Enhancement 5: Master Pan Law Compensation
📊 Level Management
Principle: Compensate for power buildup from multiple bands
Implementation: -3.5dB gain reduction on wet signal
Benefit: Maintains consistent loudness, prevents clipping
Formula: gain = 10^(-3.5/20) ≈ 0.668
Parameters & Settings
Core Processing Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| Preset | optionmenu | Custom | Predefined configurations |
| Number_of_bands | positive | 8 | Number of frequency bands to process |
| Pan_width | real | 0.8 | Stereo spread amount (0=mono, 1=full spread) |
| Bandwidth_octaves | real | 0.5 | Bandwidth in fractional octaves |
| LF_protection_frequency | positive | 150 | Bass frequency cutoff for mono protection |
| Dry_wet_mix | real | 1.0 | Mix between dry and processed signals |
Parameter Guidelines
Auto-calculated Parameters
Applications
Music Production
Use case: Enhancing stereo width of mono sources
Technique: Apply Standard Spread to vocals, instruments
Example: Mono vocal made stereo while keeping low-mid fundamentals centered
Sound Design
Use case: Creating complex stereo textures from simple sounds
Technique: Use Extreme Spray or Dense Shimmer presets
Example: Turning mono noise into rich stereo atmospheric beds
Mastering
Use case: Controlled stereo enhancement
Technique: Subtle Widening with 20-40% wet mix
Example: Gentle overall width increase without compromising mono
Audio Restoration
Use case: Mono-to-stereo conversion of archival material
Technique: Custom settings matching source characteristics
Example: Converting vintage mono recordings to believable stereo
Practical Workflow Examples
🎤 Vocal Stereo Enhancement
Goal: Add natural stereo width to mono vocal
Settings:
- Preset: Standard Spread
- LF protection: 180 Hz
- Dry/wet: 70%
- Additional: 12 bands for vocal detail
Result: Vocal with enhanced presence and width, stable low-end
🎹 Synth Pad Texturing
Goal: Create evolving stereo texture from simple synth
Settings:
- Preset: Dense Shimmer
- LF protection: 120 Hz
- Dry/wet: 100%
- Additional: 24 bands for maximum detail
Result: Rich, constantly moving stereo pad texture
🥁 Drum Mono-to-Stereo
Goal: Convert mono drum loop to stereo
Settings:
- Preset: Coarse Texture
- LF protection: 100 Hz
- Dry/wet: 85%
- Additional: 6 bands for punchy separation
Result: Stereo drums with kick centered, cymbals spread
Advanced Techniques
- Vocal enhancement: High LF protection (180-250 Hz), more bands for detail
- Bass instruments: Low LF protection (80-120 Hz), fewer bands
- Percussion: Medium LF protection (120-150 Hz), wide bandwidth for natural sound
- Full mixes: Light touch (30-50% wet), Standard Spread preset
- Special effects: Reverse preset, extreme settings, 100% wet
- Automated panning: Process different sections with different presets
- Frequency-selective effects: Combine with EQ before spraying
- Layering: Mix heavily sprayed and dry versions
- Mid-side processing: Extract sides after spraying for further processing
- Serial processing: Apply multiple spray passes with different settings
Troubleshooting Common Issues
Cause: Too many bands or extreme pan width
Solution: Reduce band count, decrease pan width, increase bandwidth
Cause: LF protection too high or extreme panning
Solution: Lower LF protection frequency, reduce pan width for low bands
Cause: Too many narrow bands
Solution: Reduce band count, increase bandwidth, use S-curve mapping
Cause: Dry/wet mix too low or extreme settings
Solution: Increase dry/wet mix, check master gain compensation
Cause: High band count on long files
Solution: Reduce band count, process shorter segments, use faster presets