Skip to content

The plate: Dattorro's figure-8 tank as a second reverb (reverbs.md chunk 1) - #144

Merged
ninjudd merged 3 commits into
mainfrom
dsp/plate
Aug 11, 2026
Merged

ninjudd merged 3 commits into
mainfrom
dsp/plate

Conversation

@ninjudd

@ninjudd ninjudd commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Chunk 1 of docs/projects/all/reverbs.md, flipping the plan to Active: plate, Dattorro's 1997 figure-8 tank, as a second reverb insert beside the Freeverb classic — one streaming class in dsp/ serving both render paths, with the analytic tail, the schema through the engine, and the golden the plan's definition of done names.

The architecture is the paper's, whole: predelay, the published input one-pole (bandwidth 0.9995), four series input diffusers, then the tank — two cross-fed branches of modulated allpass → delay → damping → decay → allpass → delay, with the published output tap table for stereo. Tunings are sample counts at 29 761 Hz and scale to the session rate by rounding, the way the Freeverb port's do and for the same reason: truncation shifts every tap, and the onset property pins the exact sample (an impulse's first left output lands at predelay + scaled(266), the shortest published tap). Stereo input mono-sums into the tank — a plate is one sheet of metal — and the taps are what make it wide: the mono-sum test asserts identical channels in still produce a fully decorrelated wet field, the opposite of Freeverb's offset-spread twins. diffusion is input diffusion 1 directly with #2 riding at the published 5/6 ratio, so the default is the paper's pair; the tank's decay-diffusion magnitudes stay at the paper's values (0.70, and clamp(decay gain + 0.15, 0.25, 0.50)), and every lattice sign matches figure 1 exactly — verified against the JAES scan itself after Codex's review, which also caught two transposed entries in the left tap row (now fixed, with Table 2 quoted verbatim beside the constants). The diffusion cap is 0.93: at the schema's 1 s decay floor the input allpasses' own ring must stay inside the declared tail, and the worst corner (decay 1, diffusion 0.93) measures −58.0 dB per decay-second, pinned by its own property test — at the 0.98 the cap replaced it reads ≈ −56 and truncates audible ring.

decay is T60 and means it, which took a measurement: the per-circulation feedback derives from the actual scaled loop length with the four diffusers weighted 1.38 — an allpass's mean group delay is its length, but the tail's energy rides the low bins where it is longer, so no closed form lands on the measured slope, and the constant is calibrated (least-squares dB slope over the 10–90% tail, decay 1/2/4 s, all within ±1.3 dB of −60) and then held by the same property test that holds Freeverb's. The schema floors decay at 1 s: the tank's fixed diffusion allpasses ring for ~0.9 s at the published coefficients, and a shorter T60 would out-ring the analytic tail (growth = predelay + decay·rate, decision 5's arithmetic, mirrored in the compiler's chainGrowth and the engine's warmup as one pair).

Modulation is decision 4 implemented: both branch allpasses sweep their read points on detuned ~1 Hz LFOs (0.943/1.117 Hz, published in the header) whose phase is a pure function of the engine's unwrapped clock — the streaming class carries a counter that startAt() initialises to wherever the chain starts rendering: zero offline and at load, the warmup start at a locate (buildChain gained the start-clock parameter for exactly this). So the golden runs with modulation ON and a limiter in front: the offline whole-buffer render and the live blocked render agree byte for byte, which is the test that the LFO belongs to the timeline rather than to the block structure — including behind a stage whose stream lags in arrival but not in content (cursor's review asked after exactly this, and the bytes answer it). modulation: 0 reads the integer delay exactly and is bit-frozen — the dsp-check fixture's default case, with a second non-zero case beside it, both bit-identical across block sizes 1/7/128/480/4096.

The versions move as decision 6 says: RENDER_PLAN_VERSION 8 → 9 (the C++ constant moves with it), daemon 0.8.0, and the session insert union gains the arm — an old daemon's fail-closed parse rejects a session carrying a plate with its unknown-effect error, and the session arm mirrors the two load-bearing bounds (decay >= 1 s, diffusion <= 0.93) so a hand-crafted session cannot carry values the tail arithmetic cannot honour. Existing songs are untouched: action keys don't hash the plan version, and field build creek on bloom comes back all cached, the proof the plan asked for. The suite grows 611 → 617: five plate properties (T60 slope, the worst-corner slope, exact onset, modulation determinism + frozen zero, mono-sum-wide) and the modulated golden.

The listening comparison is the branch listen/plate-creek (stacked on this one, no PR — the example changes when the ear decides): creek's shared room space swapped from reverb to plate, same decay and predelay, rebuilding exactly space and main.

Testing

From the repo root: pnpm build && pnpm build:native && pnpm test — 40 files / 617 tests green (the native rebuild is required: RENDER_PLAN_VERSION is 9 and the daemon is 0.8.0, so a stale daemon refuses with its rebuild message — cd examples/bloom && field transport quit if one is running). ./native/audiod/build/field-dsp-check prints ok lines for plate mod=0.000000 and plate mod=0.300000 at every block size. cd examples/bloom && field build creek — every line says cached: the version bump moved no action keys. For the ear: git checkout listen/plate-creek && cd examples/bloom && field build creek (exactly space and main rebuild) then field play creek — the room is now the plate; git checkout main and the same two commands A/B it back to Freeverb. What would show this wrong: the plate golden failing (the modulated live render diverging from the offline artifact — the LFO leaking block structure), the onset property landing one sample off (tap misalignment), or creek's build showing built lines on this branch without the example edit (a cache invalidation the plan promised away).

@minjudd

minjudd commented Aug 11, 2026

Copy link
Copy Markdown

Starting review of 5d03778.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 5d03778. Configure here.

Comment thread src/audiod/session.ts Resolved
Comment thread native/audiod/src/live.cpp Resolved
@minjudd

minjudd commented Aug 11, 2026

Copy link
Copy Markdown

Starting review of 5edb6c9.

minjudd
minjudd previously approved these changes Aug 11, 2026

@minjudd minjudd left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving 5edb6c9. This is stacked on #143, so I reviewed its own diff (ffae1a7..5edb6c9) and ran the gate against the combined tree, since a clean base does not vouch for the child.

The determinism argument I asked for in the plan review is implemented correctly, which was the thing to check. reverbs.md §2.4 promised the LFO phase would be a pure function of the unwrapped clock with the counter initialised at the warm-up start rather than the landing position, and locate now computes from first so it can pass it:

const juce::int64 from = std::max<juce::int64> (0, sample - warmup);
buildChain (output, from);

Both call sites are right — the constructor takes the default zero, the seek passes from — and in plate.cpp the phase really is sin(2π · rate · clock/sampleRate) with ++clock per sample, so a seek's phase converges on a from-the-top render's by the time the audible position arrives. That follows from the two halves rather than needing its own test, and the harness pins the block-partitioning half directly.

I verified the golden independently, with deeper modulation than the suite's fixture uses (0.9 rather than 0.3), a 2.5 s tail and a 20 ms predelay:

frames: live 144960, offline 144960, tail arithmetic says 144960
byte-identical: true

The frame count is the part worth calling out: the compiler's chainGrowth, the engine's tailSamples() and the wrapper's padding all land on the same number independently, which is decision 5's "the pair that must always agree" holding across three implementations of it.

field-dsp-check is clean end to end, and the plate's ten partitions include modulation at block=1 — every sample its own block, which is the strongest form the block-invariance claim has. The shared testSignal carries subnormals (1e-40f, -3e-39f) inside its silence run, so the plate meets chunk 1's subnormal case too rather than only its block-invariance one.

The two fixes this round are both real. The session parse mirroring the authoring floor and cap closes a genuine gap: decay under 1 s would have out-rung the analytic tail that chainGrowth and chainWarmup both compute, and the session schema was the one door that would have let it through. Leaving the upper limits out is the right line — those are taste, not correctness, and the comment says so. Putting a limiter in front of the plate in the golden is the better of the two additions: it pins that a stage which lags in arrival but not in content leaves the plate's counter meeting timeline sample n as sample n, which is exactly the interaction #138's availability-not-shift resolution makes non-obvious.

The DSP reads as a faithful port. The tap table's fourteen offsets all sit inside their lines with room (3627 against 4453 is the tightest), so readAgo's wrap is unreachable; the modulated allpass buffer is length + (long)excursion + 2 against a maximum read of length + (long)excursion + 1, which fits with one slot spare; and the predelay is guarded and indexed directly rather than through readAgo, so a zero predelay cannot reach the empty-buffer path. decayGain deriving from the actual scaled loop keeps the T60 knob measurable at every rate, and the 1.38 diffuser weight being measured with the slope test holding it there is the honest way to handle a constant with no closed form.

The plumbing is complete and symmetric. Schema and session arms, plan.cpp validating against limits generated from the same zod source, render.cpp calling the same wrapper the streaming class mirrors, RENDER_PLAN_VERSION and renderPlanVersion moving together to 9, the daemon to 0.8.0. No generator version moved, so decision 6's "action keys never move" holds by construction — existing songs cannot rebuild.

Docs move with it: build-graph.md and tracks.md both stop presenting reverb as the reverb, reverbs.md goes Draft → Active rather than Shipped with hall still owed, and now.md says which chunk landed.

Gates: pnpm typecheck clean, pnpm build:native clean, pnpm test 40 files / 616 tests green.

One thing for the merge rather than the code: #143 is still open, so this cannot land first. When you merge the base, check that this retargets and is still mergeable rather than assuming — and the gate is worth re-running here afterwards, since the child's tests will then be running against code the base just moved.

No findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5d03778869

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread native/audiod/src/dsp/plate.cpp Resolved
Comment thread native/audiod/src/dsp/plate.cpp Resolved
Comment thread src/schema/effects.ts Resolved
@minjudd

minjudd commented Aug 11, 2026

Copy link
Copy Markdown

Starting review of 8b6b985.

@minjudd minjudd left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving 8b6b985. This changed the sound, so I re-ran everything rather than carrying the previous head's results.

The tap row correction restores the canonical table. The left output taps now read 266, 2974, 1913, 1996, 1990, 187, 1066 — Dattorro's published seven — where the old row had 145, which is in no row of table 2, and carried 1996 on the wrong line. Quoting the table verbatim in the comment is what makes it checkable, and the code matches it entry for entry, branch and line included. The right row was already correct and is unchanged.

The onset survives the correction, which is the useful check on it. An impulse through a 20 ms predelay:

first non-zero left sample: 1389, table-2 onset says 1389

960 predelay samples plus round(266·48000/29761) = 429. So the earliest tap is still the shortest published one on the opposite branch's first delay, and the "entered the line k samples ago" read alignment the fourteen taps share is intact after moving two of them.

The lattice signs are the one thing I cannot check against the source, so I checked what I could: the change is self-consistent (four input diffusers and decay diffusion 2 negative, decay diffusion 1 positive), both branches carry identical coefficients, allpassStep puts the same coefficient in both lattice positions with opposite signs so footnote 8's requirement holds by construction, and every |g| stays under 1 so no lattice is destabilised. The empirical constraints all still pass after the flip — T60 slope, tap onset, block-invariance, and offline-versus-live — which is what I would expect from a sign convention change and would not expect from a wrong one.

The diffusion cap is now justified by arithmetic I could reproduce. An allpass at gain g and length L holds energy for L·ln(10⁻³)/ln(g) samples, so the 142-sample lattice at 48 kHz (229 samples scaled) needs ≈95 circulations at 0.93 → 0.45 s, and ≈342 at 0.98 → 1.63 s. Both figures land where the comment says. Tying the cap to the decay floor of 1 s is the right relation — an input diffuser that rings longer than the shortest declared tail makes the analytic tail truncate audible ring — and the worst-corner test pins it at exactly the two extremes that matter, so loosening the cap fails a test rather than quietly degrading.

Re-verified at this head, not carried over: offline and live still byte-identical with modulation at 0.9 and diffusion at the new cap, and all ten plate partitions bit-identical including modulation at block=1. Gates: pnpm typecheck clean, pnpm build:native clean, pnpm test 40 files / 617 tests green.

Everything else stands from my review at 5edb6c9: the LFO seeded at the warm-up start rather than the landing position, the tail arithmetic agreeing across compiler, engine and wrapper, the session parse mirroring the load-bearing bounds, the plan and render arms, both version constants moving together, and no generator version moving so existing action keys cannot shift.

Two things for the merge rather than the code. #143 is still open, so this cannot land first — when you merge the base, check this retargets and re-run its gate, since the child's tests will then be running against code the base just moved. And if you auditioned the plate at 5d03778 or 5edb6c9, those cached stems are now stale in a way the cache cannot see: the spec is unchanged so the action key is unchanged, but the DSP under it moved twice. field build will report a hit and hand you the pre-correction sound. Worth clearing those entries before the creek listening pass, or the A/B will be against the wrong plate.

No findings.

Base automatically changed from engine/cross-rate-live to main August 11, 2026 14:41
…unk 1)

Both render paths through one streaming class: predelay, the published
input one-pole, four series diffusers, and the modulated tank with the
paper's tap table, tunings scaled from 29761 Hz by rounding. decay is
T60 and means it - the per-circulation feedback derives from the scaled
loop with a measured diffuser weight, held by a property test like
Freeverb's. The LFO phase is a pure function of the unwrapped clock
(counter starts at zero offline and at load, at the warmup start on a
locate), so modulation is on in the golden and the bytes still agree.
RENDER_PLAN_VERSION 9, daemon 0.8.0; existing songs rebuild as pure
cache hits (proven on creek). dsp-check gains both modulation cases;
suite 611 -> 616. Docs sweep: tracks.md and build-graph.md present
freeverb as the classic beside the plate; reverbs.md flips to Active.
… limiter in front

The session arm now refuses decay under 1 s and diffusion above 0.98
(cursor's finding): both floors are what the analytic-tail arithmetic
rests on, so a hand-crafted session carrying either would be quietly
wrong - exactly what the parse exists to refuse. The modulated golden
now runs limit -> plate, pinning that a limiter's arrival lag does not
move the plate's LFO off the timeline: the counter counts stream
samples, which are content-aligned, and the bytes agree.
…iffusion cap

Codex's review sent me back to the primary source (the JAES scan),
which settled three things. The left output row had two entries wrong -
the published table reads +delay2R[1996] and -delay1L[1990] where this
port had +delay2R[145] and -delay1L[1996] - now fixed, with Table 2
quoted verbatim beside the constants so the next review is a diff
against the quote. Checking the claimed branch-polarity difference
against figure 1 refuted it (both decay-diffusion-1 blocks are drawn
identically, and footnote 8 requires a lattice's two coefficients to
match) but surfaced that this port's absolute signs were globally
mirrored; all lattice signs now match the figure exactly - input
diffusers and decay diffusion 2 negative, the sign-noted pair positive.
And the diffusion cap comes down to 0.93: the input allpasses' own
ring at 0.98 out-lived the 1 s decay floor (measured ~-48 dB per
decay-second), while 0.93 keeps the worst corner inside the T60
window (measured -58.0), now pinned by a corner property test.
Suite 616 -> 617; the T60 calibration is unchanged by the sign flips
(magnitudes untouched: -59.7/-58.8/-58.8 across decay 1/2/4).
@ninjudd
ninjudd merged commit 6ac0829 into main Aug 11, 2026
1 of 2 checks passed
@ninjudd
ninjudd deleted the dsp/plate branch August 11, 2026 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants