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.

Author: Shai Cohen Affiliation: Department of Music, Bar-Ilan University, Israel Version: 0.4.1 (2026) License: MIT License Repo: GitHub
Contents:

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:

past tap x[n - D] dry tap x[n] future tap x[n + D]

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.

The result can exhibit comb-like spectral interference and temporally displaced coloration because multiple copies of related material are added with positive or negative coefficients. The exact response changes from state to state as delay, phase and superposition strength change.

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 termActual DSP meaning
StateOne three-tap FIR processing pass in a cascade.
Superposition strengthA scalar controlling dry/wet coefficient magnitudes.
Probability amplitudeA deterministic sine-shaped weighting applied to the wet component according to state number.
Phase shiftA cosine/sine rotation of the coefficients assigned to the ±D real-valued taps.
Collapse / decayMultiplication of the superposition-strength parameter after each state.
The cosine/sine operation is not a Hilbert-transform or analytic-signal phase rotation of the audio waveform. It rotates two real FIR tap coefficients.

Quick start

  1. Select exactly one Sound object.
  2. Run Quantum_State_Superposition.praat.
  3. Choose Custom or one of the four named presets.
  4. Choose whether the initial superposition strength is fixed or randomly drawn from a range.
  5. Choose whether phase is fixed or independently randomized for every processing state.
  6. Set the state-offset progression and superposition decay.
  7. Run the script. The result is named <source>_quantum.
There is no random-seed control. If either random superposition or random phase is active, repeated runs can produce different results.

One processing state

At state s, let:

q = current superposition strength p = state-position weighting φ = phase-shift parameter D = state offset in samples dry = sqrt(1 - q) wet = sqrt(q) × p

For samples where both offset taps exist, the state computes:

y[n] = sqrt(1-q) × x[n] + sqrt(q) × p × ( cos(φ) × x[n+D] + sin(φ) × x[n-D] )

The three exact FIR coefficients are therefore:

past / -D: sqrt(q) × p × sin(φ) dry / 0: sqrt(1-q) future / +D: sqrt(q) × p × cos(φ)

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.

Each individual state is therefore feed-forward FIR. The complete processor is still cumulative because State 2 processes the completed output of State 1, State 3 processes State 2, and so on.

State-position wet weighting

The variable named probAmplitude is now used directly by the DSP:

p(s) = sin( s × π / (States + 1) )

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:

S1 0.500 S2 0.866 S3 1.000 S4 0.866 S5 0.500

The weighting multiplies only the wet ±D contribution; it does not multiply the dry coefficient.

This weighting should not be interpreted as a physical probability. It is a deterministic envelope over processing-state index.

No guaranteed energy conservation

The old documentation described the square-root law as energy conserving. That is too strong. For the three coefficients themselves:

dry² + past² + future² = 1 - q + q × p²

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:

future coefficient ∝ cos(φ) past coefficient ∝ sin(φ)
φcos φsin φWet tap distribution
0+10future tap only
π/4+0.707+0.707equal positive future/past coefficients
π/20+1past tap only
π−10inverted future tap
3π/20−1inverted past tap
+10same 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:

D(s) = round( totalSamples / (State_offset_base + s × State_offset_increment) )

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:

delaySeconds(s) ≈ duration / (State_offset_base + s × State_offset_increment)

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:

q_next = q_current × Superposition_decay

Before every processing state, q is again clamped to 0…1.

All named presets use decay below 1, which fits the script's “collapse” metaphor. Custom values above 1 are permitted by the positive form field; in that case the parameter is no longer a decay and the strength grows toward saturation instead.

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.

PresetStatesRandom q range / fixed qRandom phase range / fixed phaseOffset base + incrementDecay
Default50.30–0.80 / 0.550.10–6.283 / 3.1415910 + 2/state0.75
Gentle Quantum Drift40.20–0.50 / 0.350.10–3.14 / 1.5712 + 3/state0.85
Intense Superposition60.60–0.90 / 0.750.20–6.00 / 3.141598 + 2/state0.70
Phase Entanglement70.40–0.90 / 0.650.50–5.50 / 2.6189 + 1.5/state0.80
“Random q range / fixed q” means the switch Use_fixed_superposition decides which of those preset values is actually used. The same rule applies to random versus fixed phase.

Parameters

ParameterDefaultExact role
PresetDefaultDefault, Gentle Quantum Drift, Intense Superposition, Phase Entanglement, or Custom.
States5Number of cascaded three-tap FIR states.
Superposition_min0.3Lower bound for the one initial random q draw.
Superposition_max0.8Upper bound for the initial random q draw.
Use_fixed_superpositionOffUse Fixed_superposition instead of a random initial q.
Fixed_superposition0.55Initial q when fixed mode is enabled; internally clamped to 0…1.
Phase_shift_min0.1 radLower phase bound in random-phase mode.
Phase_shift_max6.283 radUpper phase bound in random-phase mode.
Use_fixed_phaseOffUse the same Fixed_phase_shift at all states.
Fixed_phase_shift3.14159 radCoefficient-rotation angle used by every state in fixed mode.
State_offset_base10Positive denominator base in the duration-relative offset law.
State_offset_increment2Positive per-state denominator increment.
Superposition_decay0.75Multiplier applied to q after each state; must be >0.
Scale_peak0.96Target peak used after the complete cascade.
Draw_visualizationOnDraw Source → state-interference map → Output → Summary.
Play_resultOnPlay 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:

n + D inside file AND n - D inside file

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:

Scale peak: Scale_peak

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.

  1. Source waveform: original Sound.
  2. Quantum state interference map: one row per actual processing state.
  3. Output waveform: completed normalized result.
  4. 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:

PositionTapColor role
−Dpast sample x[n-D]purple
0dry sample x[n]neutral gray
+Dfuture sample x[n+D]orange

The map therefore shows the actual three-tap kernel geometry and coefficients for every processing state, rather than an illustrative quantum diagram.

Output behavior