The phase-vocoder path is implemented by ResynthesizerGeneric (private/src/Resynthesis.hpp) and driven by GrainManagerGeneric (private/src/DelayLine.hpp). Quad Delay uses one packed four-channel instance; sample playback uses one packed three-channel instance per track. Channels share the grain launch schedule, transforms and overlap-add storage while retaining independent spectra, read positions and phase propagation.
The Quad Delay uses a moveable read head in warped time. Without correction, variable read speed causes strong pitch shifts.
The phase vocoder decouples time-stretch from perceived pitch so delay-time warping can happen while keeping spectral pitch stable.
GrainManager::Process() runs every engine sample and launches a new grain every Resynthesizer::GetSynthesisHopSamples() engine samples: the duration of the analysis hop H = N / 4 (x_hopDenom = 4, GetGrainLaunchSamples() host samples). Analysis reads host-rate audio; the synthesized frame is N * x_oversample engine samples long.
For each launched grain:
startTime).startTime - H.GrainManager::StartGrain(...).Resynthesizer::PrimeAnalysis(previousWaveTable) stores previous bin phases/magnitudes.DFT::Transform(buffer)ProcessPhases() computes:
m_analysisMagnitudes[bin]m_analysisPhase[bin]m_omegaInstantaneous[bin] via phase-deviation formula:
omega_bin * Homega_binPVDR::Analyze() builds leader/follower bin relationships.Oscillator::FixupPhases(detune, pvdr) advances synthesis phase per PVDR result.Oscillator::Synthesize(...) writes complex bins with shift/unison gains.InverseTransform(...) interpolates the 4096-point spectrum into an N * x_oversample-sample engine-rate frame (SynthesisFrame), which is Hann-windowed again.GrainManager overlap-adds the frame into an OLAGeneric ring and reads one sample per engine sample, divided by 1.5 (four quarter-window shifts of Hann squared sum to 1.5).clock - H + PM using Catmull-Rom cubic interpolation, with PM bounded to [-H + 2, H - 2] engine samples. A fixed cleanup position retires old samples independently of the moving read head. Sample playback retains its 4H ring and existing timing.This is the “phase vocoder done right” principle in practice: phase propagation is controlled by measured inter-frame phase advance, not by naive phase reuse.
PVDR is the core phase-relationship tracker that prevents incoherent bin drift.
PriorityQueue<Entry,...> over current and previous analysis magnitudes).PVDR::Result:
m_bin: current binm_parent: leader bin this bin followsm_delta: phase increment to apply from parentm_small: low-energy/randomized handling flagbin == parent), usually using omega_instantaneous * H.PushResult() recursively flattens ancestry so each result references a stable root parent.Each channel keeps a three-state Schmitt gate per bin, using the largest magnitude across its current and reference analysis frames:
The hysteresis band preserves the previous Low or High state. Low bins receive random phase increments and are excluded from shifted synthesis. There is no separate −160 dB cutoff or amplitude-growth retrigger. Per-grain graph clearing preserves gate history; channel and full resynthesizer resets rearm the gates.
During synthesis:
FixupPhases() walks PVDR results and updates m_synthesisPhase[bin].Each grain is synthesized by 3 oscillators (x_numOscillators = 3), each maintaining its own m_synthesisPhase[].
For each oscillator, Synthesize() mixes two shift layers (Oscillator::x_numShifts = 2):
Q(1,1))input.m_shift[0])m_fade[0] with curve fade^4:
gainA = 1 - fade^4gainB = fade^4Per-bin magnitude source is m_synthesisMagnitudes[bin][channel], which is slewed to reduce abrupt spectral jumps.
Pitch shift is ratio-based (Q rational values), selected upstream in QuadDelayInputSetter from musical intervals.
Oscillator::SynthesizeSingleShift():
1/1, bins are synthesized directly.BinOmega(omega_instantaneous * shift)synthesisPhase * shifttargetFollower = targetParent - parent + binphaseFollower = phaseParent + deltaWillAlias(...) rejects bins where frequency mismatch exceeds threshold (0.5 / H criterion).So the shift is not “bin-by-bin naive remap”; it preserves PVDR structural relationships where possible.
For the delay’s Unison knob u in [0, 1], each channel uses detune ratio
d = 2^(C*u/1200), where C is 40, 45, 50, or 55 cents for channels 1–4.
The three copies have frequency multipliers 1, d, and 1/d, so their pitch
offsets are zero and +/-C*u cents. The spread is deterministic and symmetric
in cents. At half Unison, the four channels spread by +/-20, +/-22.5,
+/-25, and +/-27.5 cents respectively.
ResynthesizerGeneric::GetUnisonBase() supplies the four channel bases as
2^(C/1200) to the cached exponential mapper. Other channel counts return a
vector filled with the original 1.03 base.
1.0m_unisonDetune1.0 / m_unisonDetuneGetUnisonGainForOscillator()):
sqrt(1 - 2 * g^2 / 3)g / sqrt(3)
where g = m_unisonGain = (20^min(1, 3*u) - 1) / 19.The first third of knob travel fades in the side copies and reduces the center
gain. At one third, all three gains are 1/sqrt(3) and the pitch spreads are
approximately +/-13.33, +/-15, +/-16.67, and +/-18.33 cents across the four channels.
Further travel increases detuning while gains stay equal.
The squared gains sum to one throughout the fade.
The generic grain manager accepts per-channel host-sample offsets before analysis capture. Quad Delay passes zero and derives channel differences from its tape heads; it has no internal LFO.
From QuadDelayInputSetter into Resynthesizer::Input:
m_shift[0]: musical pitch ratiom_fade[0]: blend between dry spectral map and shifted spectral mapm_unisonDetune, m_unisonGainm_slewUp: partial rise-rate control for spectral bloomm_slewDown exists in the input struct but is not applied in this path: Synthesize calls only SetSlewUp; there is no corresponding SetSlewDown call, so the slew-down value is currently inert here.
In the delay path:
QuadDelayInputSetter computes warped read head positions.QuadGrainManager launches all four channels together at their individual mapped positions, bounded by the latest complete recorded analysis window.Resynthesizer performs phase-coherent reconstruction.This enables:
Q ratios)