Skip to content

The hall: a Jot FDN with per-band decay closes the reverbs plan (chunk 2) - #146

Merged
ninjudd merged 2 commits into
mainfrom
dsp/hall
Aug 11, 2026
Merged

ninjudd merged 2 commits into
mainfrom
dsp/hall

Conversation

@ninjudd

@ninjudd ninjudd commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Chunk 2 of docs/projects/all/reverbs.md, closing the plan: hall, a Jot feedback delay network with per-band decay, beside the plate — and the plan flips to Shipped, with the now.md line staying until the creek listening pass decides what the example ships with.

The architecture is decision 3's, whole: eight delay lines whose lengths are snapped to the nearest prime after size and the session rate scale them, so mutual primality is a property of the construction rather than of one lucky table; Householder feedback applied in O(N) as y = x − 2·mean(x), the reflection whose factor of two is what makes it orthogonal and stability algebraic; four input diffusers (the plate's lattice stage with its own primes, all short enough that the 0.93 diffusion cap's corner arithmetic carries over); and an orthogonal ± output tap pair with width blending mid/side — width 0 collapses to the mid bit-exactly, width 1 keeps the taps' full decorrelation, both pinned by a property test.

Per-band decay is the point of the FDN, and it means what it says: decay is the mid-band T60, decay_low and decay_high multiply it below ~300 Hz and above ~4 kHz, and each line derives its per-band feedback from its own actual prime length — so the mid band needs no calibration constant at all (measured −60.6/−59.9/−60.0 across decay 1/2/4, the FDN's T60 is analytic where the plate's tank needed a measured weight). The absorption's shape went through review fire and came out better: a sharper shelf-cascade draft was measurably unstable at opposing extreme multipliers (Codex rendered decay 1, decay_low 0.1, decay_high 4, size 0.1 growing to ~2.8e6 — higher-order blends rotate phase past 90° and push the composed response over unity between the crossovers), so each line now uses the classic first-order complementary crossover split, whose one-pole sections never leave the right half plane — the response stays pinned between the band gains for every admitted combination, and a corner property test renders all four multiplier/size extremes and asserts each tail dies. Accuracy survives first order because complementarity saturates fast (|1 − LP| rises past the crossover far faster than |LP| falls) and because the high delta divides by the splitter's Nyquist reach 2a/(1+a), a digital one-pole highpass never fully deflecting: the isolated bands measure −60.1 (low, at its 1.5× target) and −61.0 (high, at its 0.4× target), held by a per-band property test that filters the tail and slopes each band against its own T60. The longest band governs the analytic tail (decision 5: growth = predelay + decay·max(1, decay_low, decay_high)·rate), and the golden asserts the compiled session's extent equals exactly that arithmetic before comparing bytes.

Modulation is decision 4 again, eight-wide: every line's read point rides its own detuned ~1 Hz LFO (rates published in the header), phase a pure function of the unwrapped clock, so the golden runs with modulation ON and the offline whole-buffer and live blocked renders agree byte for byte. modulation: 0 is bit-frozen; dsp-check carries both cases at every block size.

One refactor rode along, from Justin's review of the hall's compiler arm: the per-effect tail and latency arithmetic no longer unrolls inside the compiler's walk — insertGrowth/insertLatency live beside the wire schema in session.ts, one arm per effect, and chainGrowth/chainLatency are one-line sums, mirroring how the C++ side keeps each effect's formula in its own tailSamples(). The compiler/engine duplication itself stays deliberate (decision 5's pair that must always agree, held by the goldens).

The versions move as decision 6 says: RENDER_PLAN_VERSION 9 → 10, daemon 0.9.0, the session union gains the hall arm mirroring its load-bearing bounds (decay ≥ 1 s, diffusion ≤ 0.93, multipliers bounded because the longest band is the tail). Existing songs are untouched — field build creek comes back all cached. The suite grows 617 → 623: five hall properties (mid T60, per-band T60, the corner stability sweep, modulation determinism + frozen zero, width mid/side) and the modulated golden with its extent assertion.

Testing

From the repo root: pnpm build && pnpm build:native && pnpm test — 40 files / 623 tests green (the native rebuild is required: RENDER_PLAN_VERSION is 10 and the daemon is 0.9.0; cd examples/bloom && field transport quit if a stale daemon is running). ./native/audiod/build/field-dsp-check prints ok lines for hall mod=0.000000 and hall mod=0.300000 at every block size. cd examples/bloom && field build creek — every line says cached. For the ear, the demo the plan's definition of done names: run field play creek --loop --watch and, from another shell, edit examples/bloom/songs/creek/tracks/space.yaml's insert between effect: reverb, effect: plate, and effect: hall (the hall wants decay_low: 1.3 and decay_high: 0.5 beside its decay; drop damping which the hall does not take) — each save rebuilds exactly space and main and swaps in at the wrap, which is the three-room A/B/C live. I ran that demo for real on hardware: three edit session swapped lines, one per room flip (reverb → plate → hall → reverb), with the transport position advancing continuously through every swap. What would show this wrong: either golden failing (a modulated render diverging between the paths — an LFO leaking block structure), the extent assertion failing (compiler and engine disagreeing about the longest band's tail), or the per-band property failing (a band decaying at the mid rate — the shelves not doing their job).

…k 2)

Eight delay lines snapped to primes after size and rate scaling (so
mutual primality survives both), Householder feedback y = x - 2*mean(x),
and per-line absorption deriving each band's decay from that line's
actual length - decay is the mid T60, decay_low/decay_high multiply it,
and the longest band governs the analytic tail. The band shelves blend
through third-order pole cascades: one pole never saturates between the
4 kHz crossover and Nyquist and measured ~25% slow there; three poles
put all three bands inside the T60 window (mid -59.9, low -62.5, high
-60.3 measured). Modulation is eight detuned per-line LFOs on the
unwrapped clock; the golden holds byte-identical offline-vs-live with
it on, and the session-extent assertion pins compiler/engine tail
agreement. The per-effect tail arithmetic moved out of the compiler's
walk into session.ts (insertGrowth/insertLatency beside the wire
schema, mirroring the C++ tailSamples split) - Justin's review point
on the hall arm, applied to every effect. RENDER_PLAN_VERSION 10,
daemon 0.9.0, creek all cache hits, suite 617 -> 622. reverbs.md flips
Shipped; the creek listening pass is what retires the now.md line.
@minjudd

minjudd commented Aug 11, 2026

Copy link
Copy Markdown

Starting review of 1c6e899.

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 1c6e899. Both things I raised on the plan are implemented the way the plan settled them, and I measured the headline claim rather than reading it.

The Householder is the reflection, not the projection. reflect = 2.0 * sum / 8.0 with read[k] - reflect + diffused is x − 2·mean(x) — the factor of two that makes it orthogonal. The draft's mean(x) − x would have annihilated the common mode, and this is the version that does not.

The tail governs on the longest band, whichever it is. insertGrowth uses Math.max(1, insert.decay_low, insert.decay_high) and the engine computes decaySeconds * std::max({ 1.0, decayLow, decayHigh }), so the pair agrees term for term. Bounding both multipliers at 4 in the schema means the tail is finite by construction rather than by convention.

I measured the per-band decay independently, with numbers the tests do not use — decay: 3.0, decay_low: 1.5, decay_high: 0.4, isolating each band with my own filters well outside the crossovers:

golden: byte-identical offline vs live: true
frames 220800, tail arithmetic says 220800

low  band (T60 4.5s): -62.3 dB over its own T60
mid  band (T60 3s):   -57.9 dB
high band (T60 1.2s): -59.7 dB

All three land within about two and a half dB of −60 over their own T60, so decay_low and decay_high mean what the docs say they mean. That is the claim a person judges this effect by, and it holds.

The structural choices are right and checkable. The eight base lengths are prime, and nearestPrime re-snaps after size and rate scaling — which is what actually preserves coprimality, since naive scaling destroys it. The tap rows are orthogonal (their dot product is zero, so left and right hear genuinely uncorrelated mixtures) and 1/√8 keeps them unity-power. The diffuser lengths top out at 401, so the same 0.93 cap arithmetic the plate uses keeps their ring well inside the 1 s decay floor — at 0.93 a 113-sample lattice reaches −60 dB in 0.22 s.

The third-order shelf blend is the kind of thing worth having written down. "A first-order blend never saturates in the 2.5 octaves between the high crossover and Nyquist, and measured ~25% slow there" is the measurement that justifies the extra poles, and the per-band test is what holds it — so the constant cannot quietly drift back.

Moving insertGrowth/insertLatency beside the wire schema is a real improvement, not just tidying: the analytic contract now lives next to the fields it reads, the compiler only sums, and a fourth effect touches one place instead of two unrolled walks. That the hall needed a different growth formula from reverb and plate is exactly what made the old shape awkward.

Verified at this head: field-dsp-check clean with all ten hall partitions bit-identical including modulation at block=1; offline and live byte-identical; frame count matching the tail arithmetic exactly; startAt(startClock) wired like the plate's so a seek's LFO phase converges the same way; chainWarmup and postLength both counting the hall's tail. Gates: pnpm typecheck clean, pnpm build:native clean, pnpm test 40 files / 622 tests green.

Both version constants move together to 10, the daemon to 0.9.0, and no generator version moved — so existing action keys hold and nothing rebuilds.

The plan closes correctly. reverbs.md goes to Shipped with chunk 2, which is the right moment — chunk 1 left it Active with hall owed. now.md keeps the line with the condition for retiring it: the creek listening pass flipping space between the three rooms. That is the decision the plan existed to enable, and leaving reverb in place is what makes it a real comparison rather than a memory.

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: 1c6e8995c6

ℹ️ 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/hall.cpp Resolved
Comment thread docs/projects/now.md Resolved
Comment thread docs/projects/all/reverbs.md Resolved
…ole range

Codex measured the shelf-cascade form diverging (decay 1, low 0.1,
high 4, size 0.1 grew to ~2.8e6 by the declared tail): the third-order
blend rotates phase past 90 degrees, so with opposing extreme
multipliers the composed response exceeds unity between the crossovers.
The absorption is now the classic first-order complementary split -
low + mid + high sum to the input exactly, each band takes its own
per-pass gain, and one-pole sections never leave the right half plane,
so the response stays pinned between the band gains for every admitted
combination. The high delta divides by the splitter's Nyquist reach
(2a/(1+a)) - a digital one-pole highpass never fully deflects - which
lands the high band on target: measured mid -59.9, low -60.1, high
-61.0, and all four parameter corners decay (Codex's diverging corner
now reaches 5e-7 where it read 2.8e6), pinned by a new corner property
test. Also from the review: the now.md entry is one sentence again.
Suite 622 -> 623.
@minjudd

minjudd commented Aug 11, 2026

Copy link
Copy Markdown

Starting review of 8216db8.

@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 8216db8. This reshaped the absorption, so I re-measured everything rather than carrying the previous head's numbers.

The finding behind it is the serious kind, and the fix is the right shape. A divergent FDN is the worst failure this plan could ship — not a wrong tone but a runaway — and the old shelf-cascade form had it: three poles rotate phase past 90°, so the recombined magnitude between crossovers could exceed the largest band gain and the loop stopped being contractive. The complementary split fixes it structurally rather than by tuning: lowBand + midBand + highBand == v exactly, each band carries its own per-pass gain, and because a one-pole section's response never leaves the right half plane the composed magnitude stays pinned between the band gains. Stability is back to being algebraic, which is what decision 3 promised in the first place.

I reproduced the corner that diverged, and its mirror, both rendered through the real build:

diverged (decay_low 0.1, decay_high 4, size 0.1): early 1.61e-1, late 4.63e-6, ratio 2.87e-5
mirror   (decay_low 4, decay_high 0.1, size 0.1): early 1.23e-1, late 1.48e-6, ratio 1.21e-5

Both decay hard where the old form grew to ~2.8e6. Recording the failing configuration in the test comment is what makes that regression test readable in a year.

The highReach correction is right. A digital one-pole complementary highpass reaches only 2a/(1+a) at Nyquist, so dividing the high delta by it is what lands the composed response on the high target there; the low split needs no such correction because a one-pole lowpass is exactly 1 at DC. The residual at Nyquist is the low splitter's leakage, about 2% of lowGain − midGain at a 300 Hz corner — small enough that the measured slopes are the real authority, which they are.

Re-measured at this head. Per-band with flat multipliers, where the broadband tail is the mid band: low −58.7 dB, mid −59.9, high −59.9 over their own T60. With multipliers apart (decay_low 1.5, decay_high 0.4) the low and high bands hold their own targets at −60.5 and −59.2. Three separate configurations all rendered byte-identically offline and live, field-dsp-check clean with all ten hall partitions bit-identical including modulation at block=1, and the frame count still matching the tail arithmetic exactly.

One note on my own numbers so they are not misread: a broadband slope measured against the mid T60 while the multipliers are apart reads shallow — I got −54 — because the longer-ringing low band dominates the late tail. That is the measurement being wrong for the question, not the filter. Isolating the bands, or flattening the multipliers, gives the figures above.

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

The claim in the header got stronger, not weaker. The old text argued three poles were needed because a first-order blend "measured ~25% slow"; the new text explains why complementarity saturates faster than a same-order shelf blend — |1 − LP| rises past its corner much faster than |LP| falls — so first-order sections suffice after all. That reads as understanding the earlier problem rather than working around it, and the per-band tests hold it either way.

Everything else stands from 1c6e899: the Householder reflection, the longest-band tail agreeing across compiler and engine, prime lengths re-snapped after scaling, orthogonal unity-power taps, startAt wired for the LFO, both version constants at 10, no generator version moved, and reverbs.md closing to Shipped with now.md keeping the line until the creek listening pass retires it.

No findings.

@ninjudd
ninjudd merged commit 8f6d8b8 into main Aug 11, 2026
1 check passed
@ninjudd
ninjudd deleted the dsp/hall branch August 11, 2026 15:52
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