Phase C scaffolding is in place. Summary: #441
No reviewers
Labels
No labels
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
refactor
rust
technical-debt
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
navicore/patch-seq!441
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "csound-phase-c"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
live.csd — Csound orchestra. OSCinit 7770 opens the listener, OSClisten
polls in a tight kgoto loop, and matched /kick freq messages schedule
instr 2 (a 0.4 s pitched tone with expon decay envelope). Held-open with
i 1 0 -1.
tone.seq — one-shot driver. Binds, sends one /kick 220.0 to
127.0.0.1:7770, closes, exits. The simplest possible audible test.
live.seq — 8-beat metronome. bpm-ms and beats are word-form constants
the user edits between runs; tail-recursive send-n-kicks threads the
socket through. 120 BPM × 8 = ~4 s of audio.
README.md — install, run-listener, run-driver, troubleshooting, mapping
back to the design doc's checkpoints 3–5.
CI now builds both tone and live binaries via build-examples. Audio
verification stays manual (you brew install csound, run it locally) —
that's checkpoints 3 & 4. Checkpoint 5 (the spinout question) waits on
you actually playing with it and writing up what you learned.
Code Review — PR #441: Phase C Scaffolding (Seq → OSC → Csound)
Overview
This PR adds four files that complete the audible portion of the live-coding POC: a Csound orchestra (
live.csd), a one-shot driver (tone.seq), an 8-beat metronome (live.seq), and their README. The implementation is clean and the PR description accurately describes what's here.Observations
live.csd— Csound orchestraRedundant
-odacflag.-odacappears in both<CsOptions>and every usage example in the README and the file's own header comment. Csound handles duplicate flags gracefully, but it creates a small confusion: readers who follow the README will silently pass it twice. Recommend either:-odacfrom<CsOptions>and keep it CLI-only (more explicit, easier to swap backends), or<CsOptions>and drop it from the README / usage comment (zero-arg invocation:csound live.csd).Busy-loop polling in
instr 1.The
kgoto loopconstruct pollsOSClistenat full k-rate (~689 Hz at ksmps=64). This is the idiomatic Csound OSC pattern, but it pins a CPU core indefinitely. For a short-lived POC this is fine; worth a one-line comment acknowledging the trade-off so a future reader doesn't mistake it for a bug.exponend-value.expon 0.5, p3, 0.001is correct — both values are non-zero and same-sign, so Csound won't error. No issue, just noting it's intentional.tone.seq— one-shot driver>aux/aux>vs.dupfor socket preservation.tone.seqstores the socket in the aux register to recover it afterudp.send-toconsumes it.live.seq'ssend-kickdoes the same thing with a stackdup. Both are correct, but usingdup(as inlive.seq) is more idiomatic for stack-based languages and avoids the implicit side-channel of the aux register. Consider rewritingtone.seqto use theduppattern for consistency:live.seq— 8-beat metronomeTiming comment inconsistency.
The module-level comment says "~4 seconds" (correct: 8 × 500 ms = 4 000 ms, since
send-kicksleeps after the last beat too). README §4 says "~3.5 seconds", which is off by half a beat. Small, but easy to fix.Hardcoded port / host in two files.
7770and"127.0.0.1"appear independently in bothtone.seqandlive.seq. The README troubleshooting section correctly warns users to update both places. For a POC this is fine, but a shared constant inosc.seq(or a separateconfig.seq) would make the edit-build loop smoother once users start experimenting.README.mdWell-structured. The checkpoint mapping at the bottom is especially useful for orienting new readers against the design doc.
One small nit: the troubleshooting entry for "Address already in use" recommends changing the port in
tone.seq/live.seqbut doesn't mentionlive.csd'sOSCinit 7770line, which also needs to match.Summary
-odacinCsOptionsvs. README/usage commenttone.sequses>aux/aux>;live.sequsesdup— pick one patternlive.csd'sOSCinitlineNo blocking issues. The scaffolding correctly delivers checkpoints 3 & 4, the tests run in CI, and the manual-only audio verification is the right call. Good to merge once the minor doc inconsistencies are tidied up.
Code Review — Phase C (live-coding-csound POC)
Overview
Phase C completes the Seq→OSC→Csound chain with three new files (
live.csd,tone.seq,live.seq) plus a README and a thorough design-doc writeup. The encoder layer (osc.seq) was established in a prior phase and is not modified here. CI integration is correct —build-examplesauto-discovers.seqfiles with amainword, so no justfile change was needed.Overall the work is solid. The notes below are mostly minor polish items, not blockers.
Findings
-odacis specified twice for most userslive.csd's<CsOptions>block already embeds-odac:The README then instructs users to run:
That passes
-odactwice. Csound tolerates duplicates silently, so it's not a bug, but it's confusing. Suggestion: remove-odacfrom<CsOptions>and keep it only in the README command line. This also gives users flexibility to swap-odacfor-o output.wavwithout editing the.csd.Inconsistent socket-juggling style between
tone.seqandlive.seqtone.seqstashes the socket inauxbefore theudp.send-tocall:send-kickinlive.seqdoes the same job with pure stack shuffling:Both are correct; both are the language's natural idiom. The inconsistency between the two files in the same POC is worth resolving for readability. The
>auxapproach is arguably cleaner when the socket handle is being threaded past multiple arguments — applying it tosend-kickwould trim aswapand make the intent clearer.Pitch is hardcoded in
send-kickbut not listed as a knobThe README says:
…and lists
bpm-msandbeats. But220.0insend-kickis equally live-codable and equally undocumented as such. A one-linerkick-hzconstant alongsidebpm-ms/beatswould complete the picture:Minor, but consistent with the stated "live-coding loop" use-case in the README.
udp.binderrors are silently droppedBoth
tone.seqandlive.seqcall0 udp.bind drop drop, discarding both the assigned port and the success flag. For a POC this is fine — bind to port 0 on loopback is essentially infallible. Worth a one-line comment on why error-checking is skipped (# port=0 bind on loopback; failure here is a hard crash anyway) if this pattern gets copied into production use.What's working well
( before -- after )annotations and the inline# ( ... )state comments make the stack evolution easy to follow.send-n-kicksis idiomatic given the language's explicit rejection of locals. The recursive pattern is clean and the base-case guard (over 0 i.<=) handles the zero-beats edge case correctly.live.csdk-rate comment (~689 Hz, far above the rate at which we send messages) is a good data point for future readers who might wonder whetherOSClistencan miss events.Summary
No correctness issues. The
-odacduplication is the sharpest edge — it's worth a one-line fix inlive.csdbefore anyone tries to record audio to a file. Thekick-hzconstant and style consistency between the two.seqfiles are nice-to-haves. The POC writeup is detailed and the spinout-recommendation deferral is the right call.