Skip to content

Effect rules: eq (Fyra auto-normalizing), limiter, reverb, chainable targets - #14

Merged
ninjudd merged 1 commit into
mainfrom
feat/effects
Aug 5, 2026
Merged

ninjudd merged 1 commit into
mainfrom
feat/effects

Conversation

@ninjudd

@ninjudd ninjudd commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Chunk 1 of the effects phase (effects.md), inserted ahead of ACE by decision — the disposability reasoning (executor replaceable, contract durable) is recorded in §1, alongside the two obligations it creates (the parity seam; effect:-discriminated insert entries).

The effects

  • eq — Fyra's eq.cpp parameterization ported verbatim: RBJ cookbook biquads, bandwidth in octaves via the sinh alpha (shelves driven from that same alpha), 45%-of-Nyquist clamp — and Fyra's response-based auto-gain on by default (48 log points 20 Hz–20 kHz, per-band dB summing as Fyra does, mean power, −10·log₁₀, ±12 clamp): EQ moves change tone, not level. Divergence from Fyra recorded in §2: the integral runs at the project rate, not pinned 48 kHz, because we re-render on rate changes anyway.
  • limit — the offline-luxury limiter: per-sample naive gain slewed dB-linearly by a backward attack pass (gain is already down when the peak arrives; lookahead_ms is the ramp length) and a forward release pass. Hard ceiling guarantee by construction, no envelope ripple, stereo-linked.
  • reverb — Freeverb (8 combs + 4 allpasses per channel, damping in the comb loops, right-channel spread), with comb feedback derived from decay as a true T60. Fully deterministic; output grows by the tail.

Wiring

  • Every single-input rule sources exactly one of asset: / target: — the clip pattern. normalize migrates from input: (breaking; field's two files update alongside this PR), which also makes normalize-of-a-target declarable, closing the loop the rate-mismatch error promises.
  • Impls declare targetDeps beside assetDeps; the graph wires both, so chains are just targets referencing targets — sc-render → eq → reverb, cached per link with early cutoff. track-render unified onto the same wiring (its custom graph block is gone).
  • Cycles are now declarable, so bloom check runs a cycle detector that spells the cycle out (target dependency cycle: a → b → a) — the engine's ordering guard must never be the first to notice.

Verified

  • 157 tests pass (20 new). DSP properties include the Fyra-documented auto-gain behaviors: narrow bells cost almost nothing, wide shelves proportionally more, directional symmetry, ±12 clamp. The limiter suite caught a real bug pre-review: the attack slew subtracted instead of added its slope, silently zeroing clean audio — exactly the class of sign error DSP tests exist for.
  • field smoke through real recipes: kit-punch (lowshelf + highshelf on the SC kit) and pad-wash (3 s reverb on the pad) built with the sc-renders cached; deps() shows asset|sc-render → eq → reverb chains; cycle/unknown-ref/ambiguous-source diagnostics all verified.

Chunk 2 next: inserts: on tracks and the mix master: chain (the limiter's real home), plus the committed field demo replacing its hand-tuned master gain.


Note

Medium Risk
Introduces new audio processing paths and a breaking normalize field rename, but changes are scoped to offline build rules with extensive tests and validation (cycles, single-source rules).

Overview
Adds chunk 1 of offline effects: three new build rules (eq, limit, reverb) with real DSP in src/audio/, wired into the existing target graph so recipes can chain like asset → eq → reverb with per-link caching.

EQ uses Fyra-aligned RBJ biquads (octave bandwidth, optional auto-normalize on by default). Limit is an offline lookahead peak limiter with stereo-linked gain slewing. Reverb is deterministic Freeverb with tail extension on output length.

Wiring changes: single-input rules (including normalize) now source exactly one of asset: or target: instead of normalize’s old input: field (breaking for existing YAML). Rules declare optional targetDeps; the graph builds rule→rule edges in input order. bloom check adds a target dependency cycle diagnostic with the cycle spelled out.

Track-render’s targetDeps is unified with the same mechanism (custom graph block removed). Schemas, tests (DSP + end-to-end chains), and plan docs (effects.md, playback shipped notes) ship with this chunk; track inserts and mix master: chains are explicitly next.

Reviewed by Cursor Bugbot for commit ccde33a. Configure here.

…targets

Starts the effects phase (docs/projects/all/effects.md), inserted ahead
of ACE deliberately; the disposability decision is recorded there - the
executor is the replaceable part, the contract is durable, exactly as
decided for the mixer.

eq ports Fyra's eq.cpp parameterization verbatim: RBJ cookbook biquads,
bandwidth in octaves via the sinh alpha, shelves driven from that alpha,
frequency clamped to 45% of Nyquist - and Fyra's response-based auto-gain
on by default (48 log points 20 Hz-20 kHz, per-band dB summing, mean
power, -10*log10, clamped +/-12): EQ moves change tone, not level. limit
is the offline-luxury form: per-sample naive gain slewed dB-linearly by a
backward attack pass and forward release pass - hard ceiling guarantee,
no envelope ripple, stereo-linked. reverb is Freeverb (8 combs + 4
allpasses, damping in the loop, comb feedback derived from T60, stereo
spread); output grows by the tail.

Wiring: every single-input rule now sources exactly one of asset: or
target: (the clip pattern; normalize migrates from input:, breaking -
field updates alongside). Rule impls declare targetDeps beside assetDeps
and the graph wires both, so chains are just targets referencing targets,
cached per link. Cycles are now declarable, so check grows a cycle
detector that spells the cycle out. 20 new tests; the limiter test suite
caught a real attack-slew sign bug before review did.

@ninjudd ninjudd left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reviewed at head ccde33a (local checkout matches). Typecheck clean, all 157 tests pass, CI green (test + Bugbot). No findings. The DSP got the deepest scrutiny of the series and held up everywhere I pushed on it.

DSP verified by hand-check against the references:

  • Every biquad formula matches the RBJ cookbook exactly — bell, LP, HP, and both shelves term-for-term, the sinh-alpha octave-bandwidth form, and a correct transposed direct-form-II with double-precision state. Unity at gain_db: 0 falls out algebraically for every type. The shelves-from-the-same-alpha and 45%-Nyquist clamp are the recorded Fyra parameterization rather than cookbook Q — internally consistent and documented as such.
  • The reverb's allpass is a true allpass — I derived the transfer function from the code: H(z) = (z⁻ᴸ − ½)/(1 − ½z⁻ᴸ), unit magnitude — which is actually more correct than literal Freeverb's not-quite-allpass. Comb feedback 10^(−3L/(T60·rate)) gives an exact per-comb T60; no randomness anywhere.
  • The limiter's construction argument is sound: both slew passes only ever lower gain below the naive curve, so the ceiling is a guarantee by algebra, not by tuning — and the test that pins the attack ramp shape is exactly the one that would have caught the pre-review sign bug.

Executed verification against this head:

  • "Tone changes, level doesn't," end to end through the rule: deterministic pink-weighted noise through aggressive EQ (+9 wide shelf; −9 shelf + +6 bell; four simultaneous moves up to ±12) with normalize: true — RMS deltas of −0.64, +0.07, −1.26 dB. (My first probe showed +3/+4 dB deltas — that was my test signal's fault, weighted steeper than pink, which the algorithm's uniform-log sampling rightly doesn't compensate for; with actual pink weighting the claim holds.)
  • Chains via the CLI: asset → eq → reverb builds link-by-link with the asset cached; rebuild is a full-chain cache hit; a gain_db: 4 → 6 band edit rebuilds exactly pad-eq and pad-wash with the asset untouched — the §3 cost model working as declared.
  • The cycle detector names the cycle: declaring pad-eq → pad-wash → pad-eq produces target dependency cycle: pad-eq → pad-wash → pad-eq from bloom check — the diagnostic, not the engine's ordering guard, is what fires.
  • The migration's failure mode is legible: a legacy input: key errors as Unrecognized key: "input" at targets.0 — findable in seconds given the field migration already landed (a5360a0, usual unmerged-window caveat noted).

Verified by reading: the targetDeps hook slots into the existing engine with zero engine changes (the #10/#11 input-hashing already covers it); the stem's custom graph wiring correctly folded back into addRule; validation collects all target names before validating so forward references work, with the recorded reason; the exactly-one-source rule lives in validate because refined objects can't join a discriminated union — same behavior as the clip refine, different mechanism, both documented; wiringFields: ['asset','target'] means renaming a referenced asset without changing content stays a cache hit; and effects.md is the right §1 record — the disposability decision with the rejected alternative, the parity-seam obligation, and the effect: discriminator reserved for the AU era.

Merging is Justin's checkpoint. Chunk 2's inserts:/master: design is already recorded in §5 and looks right from here.

@ninjudd
ninjudd merged commit 786a300 into main Aug 5, 2026
2 checks passed
ninjudd added a commit that referenced this pull request Aug 10, 2026
nested-tracks is Active — chunk 4 is revived by #123 and the soak
holds either way; Shipped was the one indefensible value. The three
stale prose lines are updated to what actually happened (voice
generation through #64/#65 and the #113 fold, effects through #14/#15
with the §6 executor move, musical time through #24), so the keyword
and the prose agree on day one. The README claims adoption, not
sharing, while agent-config#15 is still open.
ninjudd added a commit that referenced this pull request Sep 7, 2026
The audiofield.io plan in okamnesiac/audiofield (`audiofield-io.md §6`,
PR #14 there) specifies the CLI verbs the site needs from Field and asks
for a plan here to own them. This adds `docs/projects/remote/readme.md`
as a draft at `priority: next`: `field login`/`logout` over a
device-code flow, `field clone <owner>/<project>` that expands the short
name and warms the cache, `field push`/`pull` that follow Git with a
content-addressed artifact offer, a read-through remote cache in `field
build`, an optional `license:` key in `field.yaml`, and `--json` on
`explain` and `arrangement`.

The plan is grounded against main at `7c84226` rather than against the
site's assumptions. The cache is five private functions in
`src/graph/build.ts` and the hook point is the miss branch of
`buildNode` right after `readAction`; CAS reads are never verified
today, so a fetched blob has to be hashed before it lands at
`casPath()`, which the tamper-guard comment in the same function already
argues for. The remote client is injected where `GeneratorRunner` is,
`explain()` consults it too so `field explain` cannot lie about what
`build` would fetch, and Node 24's global `fetch` keeps the dependency
list at three. The manifest is `z.strictObject`, so `license:` is a
schema arm plus a `projectOrder` entry plus a diagnostic beside
`verifyAssetHashes`, and the plan says how it relates to the per-asset
`license:` that `splice.md` already designs. Eleven decisions carry
their rejected alternatives; ten open questions are listed for the sync
on the site plan, the first being priority against `recording` and `ui`.

Nothing here reopens V1 scope: a read-through cache and a push are
neither cloud collaboration nor remote rendering, and the plan says so.

## Testing

From the repository root:

```
project list
project check
project show remote | head -20
```

`project list` prints `remote` under `next` as `draft` beside `ui`,
`project check` prints `Project plans are valid.`, and `show` prints the
frontmatter, the title and the goal. Before this change `project show
remote` fails with no such project. The change is a plan only, so `pnpm
typecheck` and `pnpm test` are unaffected and were not run.

https://claude.ai/code/session_01GMG3KG8YX7mAp7dKrgPQQq
@ninjudd
ninjudd deleted the feat/effects branch September 28, 2026 04:10
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.

1 participant