Repository navigation
The live graph: field play --live evaluates the session in the engine - #138
Conversation
Creek compiles: 14 tracks, analytic lengths, limiter horizon latency, comp_delay arithmetic at summing points. Engine, verbs, golden instrument, and --live remain.
…, chains that never reset mixInputBlock replicates sumClips per sample; children render once into timeline-aligned buffers; the output streams with wrapped time so the loop fold is a performance, not an arithmetic step; ramps glide dB-linearly on window gains. Limiter grows the horizonDb parameter the chunk-1 header promised.
…to the bit outside the fold seam The golden instrument renders one pass of a session offline. Creek: 2,880,000 samples, differing only in the first 2.52 s — the loop-fold region live pass 1 has not heard — byte-identical everywhere else. Non-looping sessions are byte-exact; looping is the convergent infinite performance (fold-by-addition vs tails ringing through float state).
…al to the offline stem
Realtime chunk 2: session schema and compiler, the LiveSession engine (JIT evaluation, streaming output, never-resetting chains), session/ramp verbs, features in hello, --render-live as the golden instrument, and the e2e proving live output byte-identical to the offline stem.
|
Starting review of 9455c0e. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 9455c0e. Configure here.
minjudd
left a comment
There was a problem hiding this comment.
Reviewed 9455c0e. The golden holds, the offline path is untouched, and the creek divergence is exactly what the description says it is — I checked all three rather than reading them. One finding, about a shape the plan and the code no longer agree on.
The offline render is byte-identical across the limiter change. The horizonDb parameter defaults to 0 and limit() passes nothing, so the wrapper takes the same branch as before — but that is the argument, and #137 taught me what an argument is worth here. Two daemons, one built at 1c91287 and one at this head, cold renders of creek: 15/15 artifacts identical. field-dsp-check still reports all thirty partitions bit-identical.
The creek divergence is precisely the reverb tail, to the sample. Compiling creek's session and running --render-live against the offline artifact:
frames live=1440000 offline=1440000 rate=48000
differing samples: 120960 first: 0 last: 120959 (2.52s)
Every sample from 0 to 120,959 differs and not one after — and 2.52 s is space's reverb exactly (2.5 s decay + 20 ms predelay). So "the first 2.52 seconds, which is exactly the loop-fold region" is not a rounded description; the boundary is where the tail ends, which is what makes the contract believable rather than merely stated. The suite's own golden is the stronger half: 41 files / 629 tests green, and the non-looping case byte-compares whole Buffers.
The gating and the refusals read right. supports('session') and supports('loop') replace the semver arithmetic, and both mismatch paths say field transport quit, then play again (it respawns on the new build), which is the actionable thing. The cross-rate refusal names its own future — "live cross-rate edges land with the resampler wiring, later in chunk 2" — rather than failing obscurely. Session versioning gets the same treatment the render plan has, for the reason stated in session.ts: an engine misreading a session is a quietly wrong monitor.
I did not run field play creek --live on a real device — spawning a daemon against hardware is the one thing I stay away from — so the hand-audition step is unverified rather than verified-good. The socket test covers load, play, position, ramp, locate and stop on the null device, which is most of what that step would show.
One finding inline.
… the memory trade is recorded Cursor: delivered counter (streamFinished no longer clips the limiter tail), pullAudio takes the lock before reading liveSession. minjudd: realtime.md chunk 2 records that the engine materialises (~143 MB on creek, unbounded by the freeze) with streaming rings as owed follow-up.
|
Starting review of 34eb9d9. |
minjudd
left a comment
There was a problem hiding this comment.
Approving 34eb9d9. The amendment is what I asked for and then some, and Cursor's two fixes are both real.
The memory trade is on the record where the next person meets it. Chunk 2's amendment names the mechanism (sources preload whole, non-output tracks render into full-length buffers), the measurements (creek ~143 MB, five-minute thirty-track ~3.5 GB), the reason it was the right call anyway ("the buffers are what made the golden equivalence provable"), and the part I most wanted written down — that the freeze does not bound it, because a frozen track becomes a file window and file windows preload too. "Follow-up work owed before large sessions, not an optimisation to forget" is the right strength: it does not promise a chunk, and it does not let the debt evaporate.
position() returning delivered rather than clock is the correct fix, and its consequence reaches further than the transport line: streamFinished() reads position(), so before this a non-looping live session could end while the limiter's window still held audio. locate resetting both counters keeps them from drifting apart on a seek.
Reading the session pointer under the lock is right too. Re-verified at this head: 41 files / 629 tests green including the byte-identity golden, dsp-check all thirty partitions identical, creek's live-versus-offline divergence still exactly first: 0, last: 120959 (2.52s) and nothing beyond it, and the offline render still 15/15 byte-identical to a daemon built at 1c91287.
One observation on that lock, not a finding, because the consequence is benign in every case I could construct. The callback now takes liveLock unconditionally, where before it checked liveSession != nullptr first — so the artifact path, which used to be lock-free, can now emit one silent block on contention. The comment calls that "a rare edit", but the contending callers are load, loadSession, liveRamp, stop and locate, and three of those run during ordinary artifact playback. Each is a moment where audio is already being interrupted — starting a file, seeking, stopping — so a sub-3 ms gap costs nothing; it is the occasion the comment names that is narrower than the code's.
I did not audition field play creek --live on a real device, so that step remains unverified rather than verified-good.
No findings.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9455c0ec45
ℹ️ 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".
… unwrapped time, callback off the heap
|
Starting review of b3e0f99 — noting the commit message calls it a WIP batch; I am reviewing it as the current head regardless, and will say plainly what holds and what does not. |
…ility, and the recorded bounds comp_delay stays zero (buffers are timeline-aligned; the double-compensation would have shifted a dry sibling of a limited child — the golden now pins that case), non-loop output truncates at the declared extent, locate rebuilds the output chain, ramps glide on unwrapped time, the callback owns no heap, sessions refuse devices at the wrong rate and cross-rate graphs at compile time, transport status and locate see live sessions through the song the compiler stamps in, and the plan records the 60 dB horizon bound on the bit-identity claim.
minjudd
left a comment
There was a problem hiding this comment.
Approving 41f3c98. Four heads landed while I worked through this batch — 34eb9d9 → b3e0f99 → 5e61d5b → 41f3c98 — and nothing was published against any superseded SHA. Worth one note on that: b3e0f99 was red, one failing test, which is what its own "WIP" prefix advertised; 5e61d5b and this head are green. If a head goes up mid-batch expecting review, the label is doing real work and I read it.
Everything I verified before still holds here, re-run rather than assumed. 41 files / 629 tests green, typecheck clean, dsp-check all thirty partitions bit-identical, the offline render still 15/15 byte-identical to a daemon built at 1c91287, and creek's live-versus-offline divergence still exactly first 0, last 120959 (2.52s) — the reverb tail and nothing past it.
The comp_delay reversal is the right call and the reasoning is sound. With children materialised into timeline-aligned buffers, a chain's stream lag is availability rather than displacement — post[i] is the sample for timeline position i no matter when it became computable — so subtracting latency again would have slid content that was already aligned. The output track's own chain latency is the one real offset and delivered already carries it. Keeping the schema field for "the day a source's future does not" is right too: recording is exactly that day.
The truncation, locate and ramp fixes are each correct in kind. Zeroing output at or past length matches what applyDeclaredLength does offline, and reading outAt from delivered rather than the input clock keeps it aligned with what was heard. Rebuilding the output chain on locate is the honest answer to a seek — tails from the old position have no business at the new one. And moving ramps to the unwrapped timeline fixes a bug I would not have caught by reading: on wrapped time, rampStart = clock % length means each pass re-enters the glide's start and the old gain resurrects once per loop.
The bounds are all recorded now, which is what I asked for two heads ago and then some — the materialisation trade with its numbers, the 60 dB horizon caveat on bit-identity, and the cross-rate refusal with the artifact path as the interim answer.
One observation, not a finding: void pending; at live.ts:206 keeps a list nobody reads. maxInputLatency is still live (it feeds the reported latency), so it is only the pending array that is now dead — collected in the loop above, discarded here, with a void to quiet the compiler. This repo argued the other way in #132, removing mintId rather than keeping it as aspiration, and the comment explaining why comp_delay survives in the schema would read the same with the array deleted.
Still unverified rather than verified-good: field play creek --live on a real device. The socket test covers load, play, position, ramp, locate and stop on the null device, which is most of what an audition would show.
No findings.

Realtime chunk 2 (realtime.md §7): the graph runs live.
field play <song> --livecompiles the song into a session — every window resolved to samples, every source a built file — loads it into the engine over the socket, and the daemon evaluates it: per-track chains built from the chunk-1 streaming classes, cable receives reading the sender's pre-chain bus, nested summing whose per-sample arithmetic is mixdown.cpp's sumClips exactly, and the song's declared loop wrapping sample-exactly in the clock, which retires nothing yet but makes the loop-takeover machinery unnecessary for live sessions.The proof is the golden the plan demanded:
--render-liveevaluates a session offline into a WAV, and the new e2e test builds a project with placed tracks, fades, pan, a pre-tap cable, and an eq/reverb/limit chain, then byte-compares the live render against the offline stem — equal. Creek's full session agrees with its offline artifact everywhere except the first 2.52 seconds, which is exactly the loop-fold region: the offline render folds the final reverb tail into the start by post-chain addition, while live pass one has not heard a previous pass yet. That divergence is the recorded contract, not a bug — non-looping sessions are byte-exact; looping playback is the convergent infinite performance, tails ringing through chain state across the wrap, which the fold approximates one pass of.Three design points that emerged in the building. Evaluation is just-in-time offline rendering rather than a causal stream: every source is a file, so the future always exists, children render once into timeline-aligned buffers, and the output track streams with wrapped time and never-resetting chains; the compiler's comp_delay arithmetic rides along but stays zero until recording introduces a source whose future does not exist. The limiter grew the horizon parameter chunk 1 promised — live sessions pass 60 dB (one attack ramp of lookahead; the ceiling still holds at any depth, and only the approach ramp of a >60 dB reduction starts late), while the offline wrapper keeps the full-float-range default, so
field buildstays exact. And the session schema carries no loops on windows, because clip-looping already expands them at plan time — the engine never learns loops exist, same as the renderer.The protocol grows
sessionandrampverbs,hellogainsfeatures: ["loop", "reload", "session"], the client gates on names (supports()), and the--loopversion-parsing gate is gone. Ramps land as dB-linear glides on window gains at the next block — the mixer surface for chunk 3's file-watching diffs, which is the next slice. Cross-rate tracks are refused by the engine for now with a message saying the resampler wiring lands later in the chunk's arc; every session compiled today is single-rate.Testing
From the repo root:
pnpm build && pnpm build:native && pnpm test— 41 files / 629 tests green (627 from main plus the two live-session tests). The tests carrying this PR's claims are insrc/audiod/live-session.test.ts: the first builds the offline stem and byte-compares--render-liveoutput against it (a single differing byte fails it — that is the golden), the second drives the socket end to end on the null device: session load reporting 1,800,000 samples, play, a position that advances, a ramp accepted, locate and stop. By hand:cd examples/bloom && field play creek --liveplays creek through the engine and prints advancing musical positions; ctrl-c stops it. What would show it wrong beyond the golden:field play creek --livesounding different fromfield play creek— same graph, two evaluators — anywhere past the first pass of the loop.Note
Medium Risk
New real-time audio path and threading (try-lock during session edits) in the daemon; correctness for monitoring is backed by the non-looping golden test, but looping live vs offline fold behavior differs by design.
Overview
Realtime chunk 2 adds live graph evaluation: the song graph is compiled into a versioned session (tracks, windows, chains,
comp_delay) and evaluated in field-audiod instead of playing a pre-built stem.CLI:
field play <song> --livecompiles viacompileSession, loads the session over the socket, and streams from the engine.--render-liveruns the same evaluator offline to a WAV for golden comparison against the offline stem (non-looping sessions are the byte-exact contract).Daemon: New
LiveSessionmixes windows with the same rules as offline mixdown, runs chunk-1 streaming EQ/reverb/limiter, supports pre-tap receive windows and nested track windows, and streams the output track with optional loop wrap. The limiter gains optionalhorizon_db(live uses 60 dB; offline keeps full-depth exactness). Player treats a loaded session as the sole audio source (pullAudio+ try-lock);sessionandrampops land; hello advertisesfeatures(loop,reload,session) and clients usesupports()instead of parsing version strings.Tests:
live-session.test.tsbyte-compares--render-liveto the offline main stem and exercises load/play/ramp/locate on the null device.Reviewed by Cursor Bugbot for commit 9455c0e. Configure here.