theallelectricsmartgrid

Quadraphonic Delay and Phase Vocoder

The Quad Delay (QuadDelay in private/src/QuadDelay.hpp) is a highly complex, time-warped delay effect deeply integrated with the Theory of Time.

Time Warping and the Inverse Buffer

A traditional delay line implements the equation D(t + d) = X(t), where t is wall-clock time, d is the delay time, and X is the input signal.

The Smart Grid One implements a time-warped version of this equation. Let F(t) be the post-modulation logical time from the Theory of Time. The quad delay implements: D(F⁻¹(t + d)) = X(F⁻¹(t)) This means: “At the wall-clock time that produces the warped time t + d, output the sample that was recorded at the wall-clock time that produced the warped time t.”

Assuming F is injective (which it sometimes is, though extreme modulation can break this), this can be rewritten as: D(t) = X(F⁻¹(F(t) - d))

To implement this, the delay requires a “moveable writehead.” It must compute and store the inverse function F⁻¹.

Inverse-map timestamps use linear interpolation both when recording an ascending interval and when looking up a fractional warped position. Audio samples retain cubic interpolation. Signed absolute coordinates, including negative positions, wrap using Euclidean modulo at the physical array boundary.

Audio continues recording during time reversals. The inverse map updates only on forward motion, so backward motion reads previously mapped history; later forward motion replaces it. The turnaround sample is retained as an interpolation endpoint so the first forward interval also replaces its history. This is the intended reversal behavior.

Read/Write Head Computation (QuadDelayInputSetter)

The read and write heads are produced in QuadDelayInputSetter::Process (private/src/QuadDelay.hpp) per quad channel i.

The final head equations are:

Both heads use absolute warped-sample coordinates. The read head is projected into the selected-loop-length region behind the write head, offset by the resynthesis hop size, with delay shaped by quantized ratio and widener. This warped-coordinate window selects musical delay time; it cannot by itself ensure a complete real-time analysis window.

At grain launch, the delay maps the selected read head into real audio time, adds the delay LFO’s sample offset, then limits the start to the latest complete analysis window:

requestedStart = inverse(readHead) + sampleOffset
latestStart = latestRecordedSample - (N - 1) - 2
startTime = min(requestedStart, latestStart)

Here N = 4096 and the extra two samples support cubic audio interpolation. Starts already safely behind the writer are unchanged. Requests too close to the writer use the latest complete frame, preventing zeros or stale samples beyond the recording frontier from entering the grain. At these limits the grain follows the recording frontier until its requested time falls behind the limit again. Physical addressing remains circular, including for negative positions. Recorded sample-bank playback uses an unbounded frontier and retains its existing behavior.

Phase Vocoder Done Right

Because the read head is moving through the audio buffer at a variable rate (due to the time warping), a simple read would result in severe pitch shifting (like scratching a vinyl record).

To preserve the original pitch while allowing the time-warping to stretch and compress the audio, the delay uses a Phase Vocoder (Resynthesizer in private/src/Resynthesis.hpp).

Quad Delay Features

The Quad Delay supports a rich set of features: