Quantum State Superposition — User Guide
A quantum-inspired, fully classical audio processor that cascades noncausal three-tap FIR states. Each state combines the current signal with past and future sample-offset taps, rotates the two delayed-tap coefficients with cosine/sine weights, applies a state-position wet weighting, and changes the superposition strength from state to state.
What this does
Quantum State Superposition creates a sequence of time-domain FIR transformations. At every state, the current signal is copied to a snapshot and the output is formed from three samples of that snapshot:
The dry coefficient depends on the current superposition strength. The two offset taps share a wet coefficient, are rotated by cosine/sine weights, and are further scaled by a deterministic state-position weighting. The completed state becomes the input to the next state.
What “quantum-inspired” means here
The terminology is a compositional metaphor. The script does not simulate a quantum system, use quantum hardware, evolve a physical wavefunction, calculate measurement probabilities, or implement entanglement in the physical sense.
| Script term | Actual DSP meaning |
|---|---|
| State | One three-tap FIR processing pass in a cascade. |
| Superposition strength | A scalar controlling dry/wet coefficient magnitudes. |
| Probability amplitude | A deterministic sine-shaped weighting applied to the wet component according to state number. |
| Phase shift | A cosine/sine rotation of the coefficients assigned to the ±D real-valued taps. |
| Collapse / decay | Multiplication of the superposition-strength parameter after each state. |
Quick start
- Select exactly one Sound object.
- Run
Quantum_State_Superposition.praat. - Choose Custom or one of the four named presets.
- Choose whether the initial superposition strength is fixed or randomly drawn from a range.
- Choose whether phase is fixed or independently randomized for every processing state.
- Set the state-offset progression and superposition decay.
- Run the script. The result is named
<source>_quantum.
One processing state
At state s, let:
For samples where both offset taps exist, the state computes:
The three exact FIR coefficients are therefore:
Snapshot processing
Before every state, the current result is copied to a temporary snapshot. All three taps for that state are read from the snapshot. Samples modified earlier in the same Formula pass are never fed back into later samples.
State-position wet weighting
The variable named probAmplitude is now used directly by the DSP:
For all processing states, this weighting is positive. It rises toward the middle of the state sequence and falls again toward the end.
Example for five states:
The weighting multiplies only the wet ±D contribution; it does not multiply the dry coefficient.
No guaranteed energy conservation
The old documentation described the square-root law as energy conserving. That is too strong. For the three coefficients themselves:
This equals 1 only when p = 1. More importantly, the delayed signals are correlated copies of the same audio, so coefficient-square sums do not guarantee constant output power. Constructive or destructive interference can still change the actual amplitude substantially.
Phase parameter = coefficient rotation
The phase parameter distributes the wet contribution between the +D and −D taps:
| φ | cos φ | sin φ | Wet tap distribution |
|---|---|---|---|
| 0 | +1 | 0 | future tap only |
| π/4 | +0.707 | +0.707 | equal positive future/past coefficients |
| π/2 | 0 | +1 | past tap only |
| π | −1 | 0 | inverted future tap |
| 3π/2 | 0 | −1 | inverted past tap |
| 2π | +1 | 0 | same coefficient orientation as 0 |
When Use_fixed_phase is off, a new phase value is drawn independently for every state from Phase_shift_min…Phase_shift_max. When it is on, the same fixed phase is used at every state.
State offsets
The offset is calculated in samples from the total source length:
The script then clamps the value to at least one sample and, when possible, at most totalSamples - 1.
Duration-relative behavior
Because totalSamples = duration × sampleRate, the approximate delay in seconds is:
The same parameter values therefore produce longer absolute delays on longer source files. The offset scheme is duration-relative rather than fixed in milliseconds.
With positive base and increment, later states normally use progressively shorter delays.
Offline future tap
The x[n+D] term reads future material from the snapshot. The state is therefore a noncausal offline FIR, which is valid in this file-based Praat processor but would require look-ahead in real-time processing.
State cascade & “collapse” decay
The initial superposition strength is either the fixed value or one random draw from the requested range. It is then clamped to 0…1.
After every state:
Before every processing state, q is again clamped to 0…1.
- decay < 1: wet strength decreases across states.
- decay = 1: q stays constant.
- decay > 1: q grows until it reaches the internal ceiling of 1.
Presets
Named presets overwrite States, both superposition range values, the fixed-superposition value, both phase-range values, the fixed-phase value, offset base/increment, and decay. They do not change the fixed/random switches, Scale_peak, Draw_visualization, or Play_result.
| Preset | States | Random q range / fixed q | Random phase range / fixed phase | Offset base + increment | Decay |
|---|---|---|---|---|---|
| Default | 5 | 0.30–0.80 / 0.55 | 0.10–6.283 / 3.14159 | 10 + 2/state | 0.75 |
| Gentle Quantum Drift | 4 | 0.20–0.50 / 0.35 | 0.10–3.14 / 1.57 | 12 + 3/state | 0.85 |
| Intense Superposition | 6 | 0.60–0.90 / 0.75 | 0.20–6.00 / 3.14159 | 8 + 2/state | 0.70 |
| Phase Entanglement | 7 | 0.40–0.90 / 0.65 | 0.50–5.50 / 2.618 | 9 + 1.5/state | 0.80 |
Parameters
| Parameter | Default | Exact role |
|---|---|---|
| Preset | Default | Default, Gentle Quantum Drift, Intense Superposition, Phase Entanglement, or Custom. |
| States | 5 | Number of cascaded three-tap FIR states. |
| Superposition_min | 0.3 | Lower bound for the one initial random q draw. |
| Superposition_max | 0.8 | Upper bound for the initial random q draw. |
| Use_fixed_superposition | Off | Use Fixed_superposition instead of a random initial q. |
| Fixed_superposition | 0.55 | Initial q when fixed mode is enabled; internally clamped to 0…1. |
| Phase_shift_min | 0.1 rad | Lower phase bound in random-phase mode. |
| Phase_shift_max | 6.283 rad | Upper phase bound in random-phase mode. |
| Use_fixed_phase | Off | Use the same Fixed_phase_shift at all states. |
| Fixed_phase_shift | 3.14159 rad | Coefficient-rotation angle used by every state in fixed mode. |
| State_offset_base | 10 | Positive denominator base in the duration-relative offset law. |
| State_offset_increment | 2 | Positive per-state denominator increment. |
| Superposition_decay | 0.75 | Multiplier applied to q after each state; must be >0. |
| Scale_peak | 0.96 | Target peak used after the complete cascade. |
| Draw_visualization | On | Draw Source → state-interference map → Output → Summary. |
| Play_result | On | Play the completed Sound. |
The script rejects reversed superposition or phase ranges and requires positive offset base/increment and positive decay. The public form does not impose an upper limit on States or Scale_peak.
Channels, duration & edge behavior
Channels
The processing Formula works independently on every Sound row/channel. Mono remains mono; stereo and multichannel layouts are preserved. No mono fold is used by the DSP.
Duration and sample rate
No resampling, trimming, padding, or time-domain rearrangement occurs. The output keeps the source duration, sample rate, channel count, and time domain.
Finite-signal edges
A state is applied only where both offset taps are valid:
If either condition fails, the script returns the current sample unchanged for that state. In other words, the first and last D samples of each state are dry-bypassed for that pass rather than being processed with a partial one-sided kernel.
Final peak scaling
After all states have been applied, the script measures the ordinary absolute sample extremum. If the result is non-silent, it calls:
This is target peak normalization, not an attenuate-only safety ceiling. A non-zero output whose peak is below 0.96 can be amplified to 0.96 with the default setting.
Silent output is left untouched. The script does not restrict Scale_peak to ≤1; custom values above 1 are therefore possible in Praat's floating-point Sound representation.
Visualization
The v0.4.1 Picture view replaces the older generic spectrogram emphasis with a direct representation of the implemented FIR cascade.
- Source waveform: original Sound.
- Quantum state interference map: one row per actual processing state.
- Output waveform: completed normalized result.
- Summary: preset, state count, strength mode, decay, phase mode, delay range, initial q, output duration and measured output peak.
Shared waveform scale
Source and Output use the same amplitude range derived from the larger measured sample peak. Their displayed levels are therefore directly comparable.
Reading the interference map
Each state row contains three markers:
| Position | Tap | Color role |
|---|---|---|
| −D | past sample x[n-D] | purple |
| 0 | dry sample x[n] | neutral gray |
| +D | future sample x[n+D] | orange |
- Horizontal position = actual tap offset in milliseconds.
- Bubble size = coefficient magnitude, with a physical minimum marker size for legibility.
- + / − glyph = coefficient polarity.
- Color identifies tap role only.
- q and φ at the right of each row are the exact state strength and phase used in the DSP.
The map therefore shows the actual three-tap kernel geometry and coefficients for every processing state, rather than an illustrative quantum diagram.
Output behavior
- Name:
<source>_quantum. - Duration: unchanged.
- Sample rate: unchanged.
- Channels: preserved.
- Original Sound: unchanged.
- Randomness: one initial q draw when fixed-superposition is off, plus one independent phase draw per state when fixed-phase is off.
- Random seed: no user control.
- Playback: optional through Play_result.