Repository navigation
Plan realtime: two render paths, one DSP library, cache as freeze; recording waits behind it - #135
Conversation
Drafts docs/projects/all/recording.md: the record entry mirroring generative, takes.yaml beside the bytes per the 2026-08-10 decision, transactional capture, the protocol surface, and what stays out (host monitoring). Graduates the later.md line to next.md.
|
Starting review of cea39f7. |
minjudd
left a comment
There was a problem hiding this comment.
Reviewed cea39f7. A plan that opens with "here is where the code stands, verified against main" is inviting exactly one kind of review, so I ran §2's claims one at a time. Most of them hold precisely; two citations do not, and both are the off-by-a-little kind that survives into implementation.
§2 is otherwise accurate to the line number. player.cpp:146 really is initialiseWithDefaultDevices (0, 2), output-only. main.cpp:108 really is idle = server.connectionCount() == 0 && state != "playing" && … with no armed or recording term — the bullet's point, that an armed daemon would idle-exit out from under a take, follows directly. player.cpp:41 is nullBlockSize = 512 with nullSampleRate = 48000.0 beneath it. play.ts:147 is client.daemonVersion.split('.').map(Number), which is the semver arithmetic §6 replaces. click.ts is 90 lines to the line, and it is the only production caller of the whole-file WAV codec outside wav.ts itself.
The two decisions this plan inherits check out too. The four things §1 says are already settled — Apollo-direct monitoring, dry capture by default, explicit latency, transactional capture — are all in audio-engine.md, so §8 declining to re-decide monitoring is honest. playback.md §3.4 is "Device choice is local state, not project truth", which is what §4 cites it for, and §3.6 does end with "the daemon never learns what a bar is", which is what §7 needs — I checked that one twice, because the item's headline is about blocking play and the clause is buried in its body.
The take-on-disk shape mirrors variants file-for-file, which is the claim that makes §3 more than a proposal: record: ↔ gen:, chosen: unchanged in meaning, takes: ↔ variants:, each entry carrying file and sha256 plus its provenance. Against bloom's real variants.yaml that lines up exactly, and "field choose moves it the same way" is the right consequence.
Conventions. status: Draft is the keyword that licenses §11's open questions rather than blocking on them, and none of the four re-opens a settled record — the 2026-08-10 decision fixed where a recorded take's record lives, not what the file is called, so "takes.yaml or reuse variants.yaml" is genuinely still open. Sections run 1–11, every relative link resolves, and the list moves are right: later.md loses the bundled "Recording and takes" line while keeping "Recording widget", and next.md gains a one-line entry pointing at the plan, which is what that file asks for.
pnpm test is 624 tests, and green when run against a v8 daemon — the 68 failures on a checkout without one are the usual environmental shape, not this branch.
Two findings inline, both citations.
|
Starting review of fb73005. |
minjudd
left a comment
There was a problem hiding this comment.
Approving fb73005. Both citations are right now, and the second fix went past what I asked for.
Decision 4 is the one that says it: "Rates convert at the placement, automatically, as a graph node. When a child's rate differs from its parent's, the edge implies a conversion node" — which is what "no resample at finalize, ever" was leaning on, and it now points there.
The latency bullet counts what is actually in the tree, and it kept the useful half of the miss rather than just correcting the number:
$ grep -rni "latenc" src native/audiod/src | cut -d: -f1 | sort | uniq -c
1 native/audiod/src/player.h
2 src/generators/effect-properties.test.ts
"surviving only in prose" is the right framing — it makes the load-bearing claim (no identifier, no schema field) the thing the sentence asserts, so a fourth prose mention appearing later would not make it wrong. And naming player.h:67 as "the same header chunk 1 opens for the duplex device" turns a correction into a seam the plan now knows about, which is what §2 is for.
Re-checked at this head: every relative link in the plan resolves, and the suite is 39 files / 624 tests green against a v8 daemon. CI's linux job is green on this SHA.
Everything else stands from cea39f7, where I did the work — §2's five code citations verified line by line, the four inherited decisions found in audio-engine.md, both playback.md references resolving, the take-on-disk shape mirroring variants.yaml field for field, and the Draft frontmatter, section numbering and list moves all matching the projects README.
No findings.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cea39f7fac
ℹ️ 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".
…dger pins, timestamp names, the click surface, takeless silence
|
Starting review of 5125937. |
minjudd
left a comment
There was a problem hiding this comment.
Reviewed 5125937. Five alignments against settled records is the revision most likely to cite one of them wrong, so I read each against its source. All five hold — and one of them is better than it needed to be. The finding is in the new YAML rather than the new prose.
The position rule uses the record's own field names, which is why it lands. project-model.md "Timeline and tempo" says a take manifest storing both "must define which is authoritative and when the other is derived, so the two can never disagree" — and §3 now spells them started_at_samples and musical_position, the exact two the record names, with the authority assigned. The previous head's at: and recorded_at: did not connect to that rule at all; this is the version where the plan and the record are talking about the same fields.
The ledger split is quoted in the right direction. project-layout.md §1.6's nuance note reads "pin authority splits — imported/recorded audio pins in the ledger, generated variants pin in their sound spec", which is what §3 cites it for, down to which side is which. project-layout.md is a numbered-item file, so §1.6 is item 6, "One ledger per scope" — I checked the item rather than searching for a heading.
Timestamp names are project-model.md:138's "recorded takes get timestamps (take-20260804-202355, sortable, merge-safe)" ✓, and the plan's reason for wanting them — two clones recording independently cannot mint the same path — is the same "merge-safe" the record claims.
The click and takeless bullets check out in code. cli.ts:434 is --click on field play ("overlay a metronome (rendered CLI-side; loops with the file)"), cli.ts:456 is the --watch + --click refusal with the baked-temp-file rationale, and graph.ts:581 is assertGenerated. §4's contrast — a generative entry without variants is a build that forgot a step, a record entry without takes is a session that has not happened yet — is a real distinction, and it is what §9's flow needs, since that flow loops the mix before any take exists.
pnpm test is 624 green against a v8 daemon, every relative link in the plan resolves, and CI's linux job is green on this SHA.
One finding: the new ledger example is the one block in the plan describing a file that already has a schema, and it would not validate.
|
Starting review of 7acb061. |
minjudd
left a comment
There was a problem hiding this comment.
Approving 7acb061. The ledger row validates now — I extracted the block straight out of the markdown and ran it through assetsFileSchema rather than eyeballing the shape:
ledger example: VALIDATES
All three counts fixed: assets: with a list and a name: per row, bytes instead of size, and all four WAV facts.
The numbers are internally consistent, which I did not ask for and is the part that makes the example worth copying. bytes moved 8294492 → 8294444, and that is not a nudge to make it look right:
frames 2764800 x 3B x 1ch = 8294400 + 44B header = 8294444; row says bytes 8294444
duration: 57.6s
24-bit mono at 48 kHz, a 57.6-second vocal take, and the header accounted for. Someone implementing finalize against this row can check their own output against it.
The added sentence is the right justification too — "committing to capture them here is the point of showing a row that validates" turns the schema's requirement into a statement about what chunk 2 must do, which is more than the correction needed to be.
Re-checked at this head: every relative link in the plan resolves, the suite is 39 files / 624 tests green against a v8 daemon, and CI's linux job is green on this SHA.
Everything else stands from 5125937, where I did the work: all five record alignments verified against their sources — the started_at_samples/musical_position authority rule naming the record's own fields, project-layout.md §1.6's pin split quoted in the right direction, project-model.md's timestamp tier, cli.ts:434/:456 for the click surface and its --watch refusal, and graph.ts:581 for the refusal a record entry deliberately does not inherit.
No findings.
…cording waits behind it
|
Starting review of aa593fd. |
minjudd
left a comment
There was a problem hiding this comment.
Reviewed 516a811. Two heads landed while I was verifying aa593fd, so nothing went up against a stale SHA; this covers the realtime plan, the list reshuffle and the status-convention change together.
Both of the description's falsification tests pass. native/audiod/src/dsp/ holds the six pairs — biquad, limiter, mixdown, resample, reverb, wavfile — so decision 2's "the seam already exists" is structural fact rather than aspiration. And limiter.h:10 is the non-causal construction in the code's own words: "Offline affords the artifact-free construction real-time limiters approximate: … a backward pass so gain is already down when a peak arrives (the 'lookahead' is the attack ramp length)". That is the strongest sentence in decision 3's support, and it was already written.
Every cross-plan citation resolves, including the two that needed the numbered-item idiom. playback.md §5's second follow-up is "Reload at the loop wrap (daemon 0.4, watch.md §1.1) — the protocol gains reload(path)", and watch.md §1.1 is "Swap at the loop wrap. … a reload(path) request that queues a takeover at the wrap point" — so §4's retirement list points at both halves of the thing it retires. watch.md §6 is "The takeover is audible, and deliberately not fixed", which is what later.md cites for the diagnosis, and §4's claim that later.md predicted its own deletion is true of the line as it stood. playback.md §3.6 still carries "the daemon never learns what a bar is". automation.md does design lanes realtime-evaluable — "evaluable in real time" at :13, and "Curves are pure functions of time, so offline and realtime cannot [diverge]" as its own decision 3.
The status-convention change is coherent and applied without churn. Nothing else in the repo required the prose line — no tooling reads either form, and AGENTS.md never mentioned it — so the only place needing an edit was the README, which got it. The 18 existing plans keep their **Status:** lines exactly as the new text promises; the two documents without one are the two written here. And the load-bearing content survived the deletion rather than going with it: recording.md keeps "waits behind realtime.md" as ordinary prose, which is precisely the "still worth writing, as ordinary prose wherever the document wants it" case.
Draft is the right keyword for recording, which is worth saying because the obvious reading is wrong. It now waits on a dependency, which sounds like Blocked — but Blocked is one of the three keywords that claim a plan is executable, and that claim is what makes open questions block its PRs. recording.md has four open questions it deliberately leaves open, so Blocked would break the exemption Draft exists to give it. Keeping Draft is correct.
pnpm test is 624 green against a v8 daemon, every relative link in both plans and all three lists resolves, and CI's linux job is green on this SHA.
One finding, in decision 3's inventory.
… streaming interfaces
|
Starting review of 648092d. |
minjudd
left a comment
There was a problem hiding this comment.
Approving 648092d. The inventory matches the code now, and the correction reached all three places the old sentence had leaked into rather than just the one I flagged.
Decision 3 says what the tree says. One genuinely non-causal processor, named with its citation (limiter.h:10); eq and reverb identified as causal structures whose offline shape is the interface — "whole buffers in and a computed output length out (reverb.h:38)" — which is exactly what those headers describe. And the loop fold is now named as the separate mechanism it is, with the right function: applyDeclaredLength is real, it is in mixdown, and its header comment is the fold in as many words — "With loop, the overhang folds back onto the start (one pass of the infinite performance)". Attributing it to mixdown and saying decision 1 keeps it closes the loop the old wording opened.
§4 and chunk 1 moved with it, which is the part that makes this a fix rather than a patch. §4 retires "The limiter's backward-pass implementation" alone, with "(decision 1 keeps that, loop fold and all)". Chunk 1 is now "streaming interfaces for eq and reverb (state across blocks; same algorithms), a causal successor for limit (a new algorithm)" — two different kinds of work, sized differently, which is what the code supports and what its own "the backward-pass limiter is gone" note always implied. The golden harness line even says what it is checking in each case: "a repackaging for two of the three and a replacement for the third".
Re-checked at this head: every relative link in both plans resolves, the suite is 39 files / 624 tests green against a v8 daemon, and CI's linux job is green on this SHA.
Everything else stands from 516a811, where I did the work: both falsification tests, every cross-plan citation including the numbered-item ones in playback.md and watch.md, the status-convention change being coherent and churn-free with nothing else in the repo requiring the prose line, and Draft being the right keyword for a recording plan that waits on a dependency but must keep its open-questions exemption.
No findings.
…build does not change
|
Starting review of 539ee08. |
|
Starting review of 9a02523. |
minjudd
left a comment
There was a problem hiding this comment.
Approving 9a02523. Closing the tracking-latency question by disposal rather than carrying it is the right move, and it rests on decisions that are already made: V1 monitoring is Apollo-direct and capture is dry, both in audio-engine.md, so the performer's cue never passes through Field's chains and the limiter's lookahead only ever runs at playback. The scoping of the policy is right too — audio-engine.md:73 reserves bypass-and-substitute for "when entering record mode", which is exactly the case that stops existing once the cue is Console's. The item leaves realtime.md §8 and lands in recording.md §8, where monitoring is the subject, with no orphan on either side.
I checked the equivalence claim chunk 1 now rests on, because "field build output should not change at all" is a strong thing to promise. It is right, and exactly right. limiter.cpp sets attackSlope = 60.0 / lookaheadSamples — 60 dB spread across the window — and the backward pass is g[i] = min(g_raw[i], g[i+1] + slope), whose solution is min over k≥i of (g_raw[k] + (k-i)·slope). A term from beyond the window contributes at least g_raw[k] + 60, so it can only win the minimum if some raw reduction is deeper than 60 dB. Transliterating both forms and diffing them:
a 6 dB transient deepest reduction -6.0 dB max |offline-causal| = 0.00e+0
a 30 dB transient deepest reduction -30.0 dB max |offline-causal| = 0.00e+0
a 59 dB transient deepest reduction -59.0 dB max |offline-causal| = 0.00e+0
a 61 dB transient deepest reduction -61.0 dB max |offline-causal| = 7.50e-1
a 90 dB transient deepest reduction -90.0 dB max |offline-causal| = 2.98e+1
Bit-identical up to the bound and diverging immediately past it, with the boundary at exactly 60 dB because that is the constant in attackSlope. So the plan's reasoning holds, and the precondition is "no gain reduction deeper than 60 dB" — a peak about a thousand times the ceiling, which no mix reaches. limiter.cpp's own comment hedges the same way ("the deepest plausible reduction span[s] exactly the configured time").
Worth handing to whoever writes the golden harness, since §8 leaves its tolerance open: the equivalence is conditional, the condition is checkable in one line, and a >60 dB case is the test that would show the causal twin is not a free substitution. Not a finding — chunk 1's claim is true of anything that will ever be rendered — but the harness is where the assumption should be written down rather than rediscovered.
One small thing about the citation: chunk 1 points at limiter.h:13 for "the backward pass only ever reaches one attack ramp back", and that line says the lookahead is the attack ramp length without stating the bound. What makes the bound true is limiter.cpp's 60.0 / window. The header is the right place to send a reader for what the algorithm is; the .cpp is where the sentence's load actually sits.
Re-checked at this head: links resolve in both plans, the suite is 39 files / 624 tests green against a v8 daemon, and CI's linux job is green on this SHA.
No findings.
… repackaging, the --live arc
|
Starting review of 5855517. |
minjudd
left a comment
There was a problem hiding this comment.
Approving 5855517. Three open questions become decisions, and the one with concrete code behind it — the resampler — checks out line for line.
Decision 7 is accurate to the source. resample.h opens "Fixed-ratio polyphase … The prototype is a Kaiser-windowed sinc", tapsPerPhase = 128, and resample.cpp:142 is literally const long delay = taps / 2; — so "the group delay the code already computes (taps / 2 = 64 input samples)" is not a paraphrase. 64 at 48 kHz is 1.33 ms, 1.45 at 44.1, which is what "~1.4 ms" is averaging. The inner loop really is per-output-sample (for (long n = 0; n < outN; ++n) accumulating taps products), and the offline form already reads outside the source as silence — "Outside the source is silence, as everywhere else in this directory" — which is exactly the priming a streaming form needs to reproduce it. So "the same kernel fed by a ring of input history" describes a repackaging rather than a rewrite, and the rejected alternatives name the right hazard: a second SRC is the disease decision 2 exists to kill.
Decision 6 caught something my own check missed, in its own favour. When I verified the limiter equivalence at 9a02523 I computed the causal form as raw[k] + (k-i)·slope — a multiplication — and got bit-identical output. Decision 6 says the twin must instead "run the same backward recurrence over a two-ramp buffer rather than computing ramps by multiplication, because chained addition rounds differently", and the shipped code is indeed chained addition (gainDb[i + 1] + attackSlope, limiter.cpp:42). My result was true of the algorithm and would not have been true of that implementation at scale; the plan is asking for the stricter thing, and is right to. Naming flush-to-zero as the other landmine is the same instinct — denormals in reverb tails are precisely where two paths diverge without anyone editing DSP.
Decision 8's arc is the one the repo has walked before, and citing playback.md's afplay retirement is the right precedent: an explicit flag while the new path soaks, then the flag and the old path retire together rather than leaving two permanent surfaces. Chunk 2 and chunk 4 both carry their half of it, so the arc is written into the sequencing and not only into the decision.
§8 is now "None right now", which is a fair thing for a Draft plan to say — Draft claims the implementation has not started, not that questions remain, so the keyword is still right and the exemption it grants simply has nothing left to cover.
Re-checked at this head: every relative link in both plans resolves, the suite is 39 files / 624 tests green against a v8 daemon, and CI's linux job is green on this SHA.
No findings.
Two plans for the realtime engine, in the order they will run.
docs/projects/all/realtime.mdis the one that goes first, and it records the decisions made in discussion on 2026-08-10: offline render keeps the build graph and stems, because the build graph's advantage is that stems mostly don't render at all — an edit re-renders one stem and the sums above it, and stems parallelize, which beats any full-length serial bounce on every edit after the first. What forces live and offline to agree is shared DSP, not a shared render path: the stem op and the live engine link the same causal processors, structurally cheap because both already live in one binary (field-audiod --renderruns the offline chain, andnative/audiod/src/dsp/is the shared home). Processors must be causal, deterministic, and block-size-invariant, enforced by a golden equivalence test demanding bit-identity — and the inventory turned out gentler than feared: the eq and reverb are causal structures already, the limiter's backward pass only ever reaches one attack ramp back so a causal twin buffering one ramp computes the identical gain curve, and the resampler's polyphase kernel streams with its existingtaps / 2delay. All four are repackagings;field buildoutput should not change at all, and the golden test is what proves it did not. And because live and offline are sample-identical, the engine plays cached stems for clean subgraphs and evaluates live only what is dirty — track freezing, automatic, with invalidation already implemented as the build graph's dirtiness tracking. CPU scales with what you are editing, not with the session. The loop-wrap takeover machinery retires; later.md's "audible loop takeover" line is resolved by deletion, as it predicted.docs/projects/all/recording.mdis the plan that waits behind it, drafted first in this PR's history and reshaped by review: capture becomes an input node in a graph that already runs live. It stays Draft, its list line waits in later.md, and its take-on-disk shape (ledger pins, timestamp names, both capture positions) survived two review passes against the settled records it cites.The lists move accordingly: next.md carries realtime, later.md carries recording (plan linked) and points the audible-loop-takeover line at the deletion that resolves it, and audio-engine.md's intro now names both plans instead of calling everything bare future work.
One convention changed underneath the plans mid-review: docs/projects/README.md no longer requires a prose
**Status:**line beside the frontmatter keyword (decided 2026-08-10). Two things called status meant the README spent a paragraph explaining which was real, and the second mostly restated the first. The keyword is now the only thing with the name; the story a line carried — which PRs, what is left, what a plan waits on — moves to ordinary prose where the document wants it, and the nine past plans that have a line keep theirs rather than churn.The realtime plan's three open questions — the golden test's tolerance, live rate conversion, the CLI surface — were discussed and decided during review and now live as decisions 6–8: bit-identity engineered rather than hoped for (matched floating-point environment, the limiter twin running the same chained-addition recurrence), the resampler as the fourth repackaging so there is never a second SRC, and
--livebecoming the meaning of song playback when the freeze chunk lands, on the afplay-retirement arc. Its §8 now records that nothing is open. recording.md keeps its four open questions, licensed bystatus: Draft; the PR that flips it Active answers them.Testing
Docs-only — from the repo root,
pnpm testis green (39 files / 624 tests). The realtime plan's checkable claims:ls native/audiod/src/dspshould listbiquad,limiter,reverb,resample,mixdown,wavfilepairs — the shared-library seam decision 2 says already exists;sed -n '10,17p' native/audiod/src/dsp/limiter.hshould show the comment beginning "Offline affords the artifact-free construction real-time limiters" — the non-causal construction decision 3 retires, stated in the code's own words; if either is absent, the plan's structural-cheapness argument is wrong. The recording plan's claims were verified in earlier review rounds:grep -n "initialiseWithDefaultDevices" native/audiod/src/player.cppshows line 146 opening(0, 2), andgrep -rni "latenc" src native/audiod/srcreturns exactly three hits, all prose.