Repository navigation
Land recorded takes: the record entry, takes.yaml, and placement on the track (recording.md chunk 2) - #167
Conversation
…he track (recording.md chunk 2) A take the daemon finalized was a path under .field/recording/; now it is a take of the project. `field record` ends by landing it: the bytes move to audio/<node>/<take>.wav and pin in the song's ledger where imported audio pins, a row goes into audio/<node>/takes.yaml, the new take is chosen, and the transaction is removed. `--recover` lands what it recovers and `--land <id>` covers a transaction nothing landed. The committed half is one bare entry, `- record:`, mirroring `generative:` with a person where the model was. Its node is named like a gen node's, claims audio/<node>/ in the song's namespace the same way, and an entry with no takes yet builds as silence with `check` warning rather than refusing, so the mix can be placed and looped before the first take exists. The graph expands the entry into an absolute `audio:` window over the chosen take before a track is planned, so nothing downstream learns recording exists. Placement is on the recording track's own timeline: landing subtracts the track's origin on the song — the `at`s summed down its first placement path from the output track — and the device's declared round trip, input plus output latency, converting both into the track's rate. That arithmetic is recorded on the row (`started_at_samples`, `latency`), where a loopback measurement on real hardware can correct it per take; the measurement itself is still owed. `field choose <song>/<node> --take <name>` moves `chosen` the way `--variant` does. The plan records the decisions in §13. Claude-Session: https://claude.ai/code/session_01CVAnQW78ZkZfxZ2GdKV886
minjudd
left a comment
There was a problem hiding this comment.
🔭 Projector review · model claude-opus-5[1m] · effort xhigh · CHANGES REQUESTED · took 4m 00s
1 finding thread: 0 resolved, 1 open — this review opens it.
The one finding is below and it is worth the whole review: started_at_samples is written against one origin and read against another, so a record: entry that carries its own at: lands its take somewhere other than where field record says it did. Everything else here is in good shape.
State of the head. Based on e7f862b, which is current main, so this is the only open pull request in the repo that is not behind the Projector move. tsc --noEmit is clean and the full suite is 688 passed / 25 skipped / 0 failed. project check passes, the plan stays status: in-progress / priority: now without introducing new open questions — §11's five were all resolved or deferred in #166 and this diff does not reopen them — so there is no readiness flip to gate here. The three plan citations in the new files (recording.md §3, recording.md §4, project-layout.md §1.6) all resolve.
The schema reads well and the parts I checked hold. recordEntrySchema preprocesses a null to the empty table, which is the bare - record: spelling §11 settled on, matching how sendSchema already treats a bare label. started_at_samples is a plain signed integer while latency is min(0), which is the right asymmetry given the documented case of a take that starts before the window and reads into itself. musical_position is one to three elements each min(1), matching what MeterMap.position returns.
Ordering under crash is thought through. land.ts appends the ledger row, then the take row that names it, then removes the transaction — so a crash leaves an orphan file or a pinned asset no row names, never a row whose bytes are missing, which is the direction check can describe. It also refuses to write into a takes.yaml whose record: names a different node rather than merging blindly.
On what I could not check here: this diff does not touch native/, so the daemon binary I ran the suite against is the one main already carries; nothing in the C++ needed re-verifying for this head.
… reads it Landing wrote the row relative to the track's origin while the graph added the entry's own window start on top, so a `record:` entry carrying `at:` sounded somewhere other than where `field record` said it did — every test used a bare entry, where the window start is zero and the two readings agree (minjudd's finding on #167). The graph's reading stays: the entry's placement fields mean what they mean on every other kind, and moving its `at` moves its takes. Landing now subtracts the entry's window start under the track's map, and placedAt adds it back, so the take line, the row, and the clip agree. A test with `at: [3]` on the entry proves it both ways. Claude-Session: https://claude.ai/code/session_01CVAnQW78ZkZfxZ2GdKV886
minjudd
left a comment
There was a problem hiding this comment.
🔭 Projector review · model claude-opus-5[1m] · effort xhigh · APPROVED · took 2m 22s
1 finding thread: 1 resolved, 0 open.
888d33d is clean, and the origin mismatch is genuinely fixed rather than papered over — I re-ran the same reproduction that found it.
The fix works, measured the same way the bug was. With main placing vox at song zero, the record entry at bar 3, and a take the daemon started at bed sample 0:
reported placedAt = 0
row.started_at_samples = -192000
graph clip start = 0
AGREE? = true
Before, those read 0 and 192000. The row now carries -192000, which is the documented "started before the window, so the placement reads into the take" case rather than a special one, and placedAt is windowStart + startedAt - latency, which reduces to the same onTrack - latency the graph arrives at from the other direction. Both sides now compute one number.
You moved the writer rather than the graph, which is the side I would have argued for, and the reasoning now stated in record.ts and project-model.md — "Moving the entry's at moves its takes with it, as every other entry's content moves" — is what makes a record: entry's placement fields behave like every other kind's, which track.ts already promised they did.
I checked the two maps agree, since the fix depends on land.ts projecting the window exactly as graph.ts does. They match on every reachable case: with a track time:, both build from track.time.tempo at the track's rate; without one, both build from the song's events at the track's rate, and graph.ts's rate === songRate ? tempoMap : … branch is the same map either way. The third branch in land.ts — no tempo events anywhere — cannot disagree with anything, because graph.ts plans the whole song inside if (song.time) and mints no node at all without it.
The test you added is stronger than the one I asked for. I suggested a case with a non-zero at: on the record entry; land.test.ts now covers two takes across that window and checks the rendered stem bytes rather than the arithmetic — 216000 zero samples before the second take's first sample, at bar 3 plus a beat. That would catch a regression the assertions alone would not.
Docs moved with the code: the schema comment, project-model.md and the plan all now describe the same origin, so the next reader is not left reconciling three statements.
State of the head: tsc --noEmit clean, full suite 689 passed / 25 skipped / 0 failed, project check valid, plan still status: in-progress / priority: now with no new open questions.
What remains is a human approval. This is a COMMENT review carrying an approved verdict rather than a GitHub approval — the loop reports, it does not vouch. CI on this head had not reported when I submitted, so the green above is my local run; worth letting the linux job land first, as it was CI rather than my review that caught the meter bug on #166. Draft state untouched.
Chunk 2 of recording.md: a take the daemon finalized was a path under
.field/recording/after #166; now it is a take of the project.field recordends by landing it — the bytes move toaudio/<node>/<take>.wavand pin in the song's ledger where imported audio pins, a row goes intoaudio/<node>/takes.yaml, the new take is chosen, the transaction is removed — and the nextfield buildplaces it where it was sung.The committed half
One bare entry, mirroring
generative:with a person where the model was:Its record node is named like a gen node's (the track, or
<track>-<id>), claimsaudio/<node>/in the song's namespace the same way, and an entry with no takes yet builds as silence withcheckwarning —input 1 ("record") has no takes yet — field record creek/track:lead-vocal— rather than refusing, so the mix can be placed and looped before the first take exists (plan §4). Takes with none chosen, a chosen name no row carries, a row whose asset is not in the ledger or whose bytes live outsideaudio/<node>/, a takes file naming another node, and atakes.yamlno entry claims are all errors.The record
The bytes pin in the ledger under the take's name, so the row carries the record and never a hash.
started_at_samplesis on the recording track's timeline, counted from the record entry's ownat(zero for a bare entry), at the track's rate;latencyis the device's declared round trip in the same samples; the take sounds at the entry's window start plus their difference and nothing else —musical_positionis what the song's map said at capture and is never arithmetic.Decisions worth arguing with (plan §13)
at, converted once at landing. The daemon reports the start on the bed's timeline; landing subtracts the track's origin on the song (theats summed down its first placement path frommain,land.tstrackOrigin), scales bed samples to track samples, and subtracts the entry's window start — the same reading the graph makes when it adds that start back, so the entry's placement fields behave like every other kind's and moving the entry'satmoves its takes. A track placed more than once records against its earliest placement and the take line says so; a track the song never places keeps its own timeline from zero. Rejected: storing the song position and resolving at build time, which would glue a take to the song and make it slide when the track moved. Known limit: track-localtime:maps are not consulted on the origin walk.withTakesingraph.ts): an absoluteaudio:window over the chosen take atentry.at + started_at − latency, reading into the take when that is negative. Nothing downstream — planner, render, live compile, freeze — learns recording exists.field choose <song>/<node> --take <name>moveschosen;--variantand--takeare exclusive.import.tsgainedopenLedger/appendLedgerRow, whichimportAssetand landing now share;importAsset's behaviour and output are unchanged.Testing
From the repo root (no native changes in this PR; the 0.12.0 daemon from #166 is what it drives):
47 files, 714 tests, green here. New:
src/commands/land.test.ts(origin walk over nested and repeated placements, landing with a nonzero origin and latency, a take starting before the track, a record entry with its ownat, rate conversion, refusals,chooseTake), therecord entriesblock insrc/model/project.test.ts(every diagnostic above, the namespace claim, canonical formatting), and the daemon end-to-end inrecord-daemon.test.tsnow lands its take and builds the stem — silence tostarted_at_samples, the gapless sawtooth after.By hand, null mode, in a scratch project:
The take line reads
take creek/lead-vocal ← take-… at bar 3.2, chosen (audio/lead-vocal/take-….wav, N s). The row'sstarted_at_samplesshould be120000: bar 3.2 is 4.5 s into the song andlead-vocalsits at bar 2 (2 s), so 2.5 s on the track — before this branch there was no row, and a wrong origin subtraction shows up here as216000.explainshows the stem's one clip atstart: 120000.field record --listis empty afterwards because the transaction was removed; record a second take andfield choose creek/lead-vocal --take <first name>moveschosenback.On the Apollo, from
examples/bloom: add- record:tosongs/creek/tracks/lead-vocal.yaml's inputs, thenfield record creek/track:lead-vocal --input 1 --at 17with the mix looping in another terminal, andfield build creek && field play creekafterwards. What is wrong shows up as the vocal sitting late by the round trip — thelatencyon the row is the device's claim, and that is the loopback measurement still owed.https://claude.ai/code/session_01CVAnQW78ZkZfxZ2GdKV886