Quantum State Superposition — User Guide
Quantum-inspired audio processing: applies iterative superposition mixing with probability amplitudes, phase-shifted time delays, and wave collapse decay, creating spectral interference patterns and evolving timbral states.
What this does
This script implements quantum-inspired superposition processing — a metaphorical application of quantum mechanics concepts to audio transformation. The algorithm processes sound through multiple quantum "states," where each state mixes the current signal with phase-shifted, time-delayed versions of itself using probability amplitude weighting. Superposition strength determines the mixing ratio between original and transformed states, while phase shifts create spectral interference patterns via cosine/sine components. State offsets calculated from sample count create temporal delays that interact constructively and destructively. A collapse probability mechanism progressively reduces superposition strength across iterations, mimicking quantum measurement. Result: evolving timbral transformations with chorus-like phasing, comb filtering, spectral shifting, and gradually stabilizing texture as the "wavefunction collapses."
Key Features:
- Four Preset Modes — Balanced, Gentle Drift, Intense Superposition, Phase Entanglement, plus Custom
- Multiple Quantum States — Iterative processing through 4-7 states
- Probability Amplitudes — Sinusoidal weighting based on state position
- Phase-Shifted Mixing — Cosine/sine components create interference
- Bidirectional Delays — Forward and backward time offsets
- Collapse Decay — Progressive stabilization across states
Technical Implementation: (1) State loop initialization: Calculate number of states (4-7), Determine initial superposition strength (fixed or random 0.3-0.9), Set phase shift range (fixed or random 0.1-6.28 rad). (2) Per-state processing: Calculate probability amplitude = sin(state × π / (states+1)), Determine phase shift (fixed value or random in range), Calculate state offset = samples / (base + state × increment), Apply superposition formula mixing original with delayed/phase-shifted versions. (3) Superposition formula: output = √(1-strength) × input + √(strength) × [cos(phase) × forward_delay + sin(phase) × backward_delay], Square root maintains energy conservation (probability normalization), Cosine/sine create quadrature phase relationship. (4) Collapse mechanism: After each state: strength = strength × decay_factor (typically 0.7-0.85), Progressive reduction mimics measurement-induced collapse. (5) Finalization: Peak normalization to 0.96, Optional auto-play. Key insight: Each iteration mixes current (already processed) signal with time-shifted copies, creating compound transformations. Phase shifts create spectral interference (constructive/destructive). Decaying superposition creates evolution from complex to stable state.
Quick start
- In Praat, select exactly one Sound object.
- Run script… →
Quantum_State_Superposition.praat. - Choose Preset: Default, Gentle Drift, Intense Superposition, Phase Entanglement, or Custom.
- If Custom, set states (number of quantum iterations, 4-7 typical).
- Configure superposition: use_fixed_superposition (yes) with fixed_superposition value, OR random range via superposition_min/max.
- Configure phase: use_fixed_phase (yes) with fixed_phase_shift, OR random range via phase_shift_min/max.
- Set state_offset_base and increment (controls delay timing).
- Set superposition_decay (0.7-0.85, controls collapse rate).
- Click OK — processing completes instantly, auto-plays result.
Quantum Theory (Metaphorical)
Quantum Mechanics Analogy
Mapping Quantum Concepts to Audio
Conceptual framework:
Probability Amplitudes
Sinusoidal State Weighting
Amplitude calculation:
Superposition Formula
Core Transformation Equation
The quantum-inspired mixing formula:
Square Root Normalization
Why square roots instead of linear weights?
📐 Mathematical Rationale
Linear mixing (without sqrt):
output = (1-s)×input + s×delayed
Energy: (1-s)² + s² ≠ 1 (except at 0 and 1)
Example s=0.5: 0.5² + 0.5² = 0.5 (50% energy loss!)
Square root mixing (quantum-inspired):
output = √(1-s)×input + √s×delayed
Energy: [√(1-s)]² + [√s]² = (1-s) + s = 1 (preserved!)
Example s=0.5: (√0.5)² + (√0.5)² = 1.0 (100% energy)
Quantum parallel:
In QM: |ψ⟩ = α|0⟩ + β|1⟩ where |α|² + |β|² = 1
Audio analog: √(1-s) and √s maintain normalization
Result: Constant energy regardless of mixing ratio
Phase Shift Effects
Cosine and Sine Components
Phase-dependent mixing:
Interference Patterns
How phase creates spectral shaping:
Phase = π/4 (cos=0.707, sin=0.707): Equal forward/backward creates symmetric interference Balanced spectral response Chorus-like thickening
Phase = π/2 (cos=0, sin=1): Backward delay only (looking into past) Mirror-image comb filtering vs forward Different resonance pattern
Phase = π (cos=-1, sin=0): Inverted forward delay Maximum cancellation with original Thin, hollow character (phase cancellation)
Random phase (variable): Different interference each state Complex, evolving spectral texture Unpredictable but organic character
State Offset Calculation
Temporal Delay Determination
Offset formula:
Offset Parameter Tuning
How parameters affect delay times:
Collapse Mechanism
Progressive Superposition Decay
Mimicking quantum measurement:
Decay Rate Effects
Tuning collapse speed:
Medium decay (0.75): Balanced reduction (DEFAULT) All states contribute meaningfully Gradual evolution Natural transformation arc
Slow decay (0.85): Gentle reduction Late states still significant Uniform processing throughout Less sense of evolution
Very slow decay (0.9+): Minimal reduction Nearly uniform strength all states Static character, little evolution More like parallel processing
Very fast decay (0.6-): Extreme reduction Only first 2-3 states matter Later states negligible Truncated effect
Complete Processing Pipeline
Preset Patterns
Preset Overview
| Preset | States | Strength | Phase Range | Character |
|---|---|---|---|---|
| Default (balanced) | 5 | 0.3-0.8 | 0.1-6.28 | Moderate, balanced transformation |
| Gentle Quantum Drift | 4 | 0.2-0.5 | 0.1-3.14 | Subtle chorus-like, transparent |
| Intense Superposition | 6 | 0.6-0.9 | 0.2-6.0 | Heavy spectral transformation |
| Phase Entanglement | 7 | 0.4-0.9 | 0.5-5.5 | Complex interference patterns |
| Custom | User | User | User | Full parameter control |
Default (Balanced)
⚖️ Moderate Quantum Transformation
Parameters: States=5, Strength=0.3-0.8 (random), Phase=0.1-6.28 (full range), Offset base=10, increment=2, Decay=0.75
Character: Balanced mix of original and quantum-processed signal
Effect: Clear transformation without overwhelming source material
Use case: General-purpose quantum processing, starting point for