Repository navigation
say build rule: macOS text-to-speech as a recipe - #27
Conversation
text/voice/rate are the whole action key; the output — a WAV at the project rate via afconvert — is cached, never committed. voice is required (the system default voice is a per-user setting), and the rule verifies it against say -v ? before rendering: say itself silently falls back to the default voice on a bad name, which would be an under-specified recipe lying under a stable key. Text reaches say through -f, never argv. Reproducibility is same-machine like sc-render's; the key deliberately does not chase OS versions. Voice generation stays a separate ACE-style workflow across the determinism boundary (next.md).
ninjudd
left a comment
There was a problem hiding this comment.
Reviewed at head fd968b5 (in place). CI is red, and the cause is deterministic, not flaky: the two multi-render tests exceed vitest's 5 s default timeout. One P2 for that, inline — the fix is two { timeout: … } annotations. Everything else verified clean, including the design's central factual claim, which I reproduced directly.
- P2 — the determinism and graph tests time out on CI by construction. Inline on
say.test.ts:37. Locally the file takes 9 s for 5 tests on an M3 Max, so the two tests that do 2–3 fullsay+afconvertrenders sit at or past 5 s on any slower machine — the macos-latest runner failed both at exactly 5006/5262 ms. Not a platform issue (CI ismacos-latest;sayandafconvertare present — the other three tests passed there).
Verified by execution:
- The silent-fallback claim is real, and worth having on the record:
say -v no-such-voice-xyz -o out.aiff hello→ exit 0, 28 KB rendered in the default voice. That's the under-specified-recipe failure — two Macs, same action key, different audio — and it's why the required + rule-verifiedvoiceis the right call rather than trustingsayto reject typos. - 221/221 locally, typecheck clean; the real-render tests pass (determinism byte-for-byte included) — CI's only complaint is time.
say -v '?'output format matcheslistVoices' parse (name padded to a column, 2+ space separator; names with internal single spaces survive the non-greedy match).
Verified by reading, no issues found:
- Text-as-data via
-fcloses the argv-injection shape properly (the dash-leading test pins it), and the ENOENT branch turns a missingsay/afconvertinto "the say rule needs macOS" rather than a raw spawn error. - Voice verification at execute time, not
bloom check, is the right boundary — check's verdict must not depend on this machine's voice inventory, and the emptyvalidate()says so explicitly. wiringFields: []— text/voice/rate all hash, so a text edit re-keys (pinned by the graph test) and nothing about the key depends on wiring.- The determinism-boundary line (say = keyless recipe in the graph; voice generation = ACE-style committed workflow) is drawn in the same place in the schema comment, build-graph.md, and next.md's earlier roadmap — consistent story, no drift.
ratebounded 60–720 wpm at the schema;afconverttoLEI16@projectRatehands downstream consumers the PCM16 WAVreadWavalready speaks.
Ready for Justin's merge once the timeouts land and CI greens — nothing else needs to change.
Siri voices are hidden from say -v entirely (byte-probing proved the original scratch vocal's default voice matches no nameable voice), so 'Siri' omits -v and renders with the machine's Spoken Content voice. Deliberately widens the same-machine caveat — those bytes follow a Settings toggle, not just OS updates — because the alternative is the best voices on the machine being unreachable by any recipe. The unknown-voice error now points at it.
|
Added one commit after field testing surfaced it: the original scratch vocal was rendered with the system default voice, which is a Siri voice — and Siri voices are hidden from |
Each say+afconvert render is 1.5-3s; the multi-render tests blew vitest's 5s default on CI's slower macos runner. Same style as the daemon tests' timeouts.
ninjudd
left a comment
There was a problem hiding this comment.
Scoped follow-up at head 2e4fbe4, covering the P2 fix and the Siri escape hatch (68e2e06) that landed mid-review. Typecheck clean, say tests 6/6 locally (Siri determinism included, 2.3 s — comfortably inside the new 30 s ceilings), CI green at 1m17s with 222 tests, thread accurately resolved. No findings. The timeout fix is exactly the P2's ask, extended to every rendering test including the ones sitting near the limit — right call.
On the Siri hatch — reviewed and blessed, with two footnotes for the record:
The design is sound: a recorded exception, stated in all three places (rule comment, schema comment, build-graph.md), with the unknown-voice error teaching it. The trade is real — I verified the system-voice reachability gap on this machine, and the bit-identical field render is the strongest possible evidence the hatch reproduces the original scratch vocal. The if (!siri) guard keeps verification intact for every other name, and -v omission is the only way say exposes the Spoken Content voice.
Footnote 1, a precision nit on "hidden from say -v entirely": on this machine, two Siri-branded voices are actually listable — Aman (English (India)) and Tara (English (India)) introduce themselves "Hi, I'm Siri!" in say -v '?'. The load-bearing claim survives (the system-selected US Siri voices match no nameable entry — consistent with your byte-probing), but "entirely" overstates it slightly; "the system-selected Siri voices aren't listable" is the airtight phrasing if the comment ever gets touched again. Also confirmed: no voice is literally named Siri, so the magic string shadows nothing today — if Apple ever ships a listable voice by that exact name, the hatch will mask it, which is worth the one-line comment it already effectively has.
Footnote 2, the operational sharp edge implied but not stated: after a Settings toggle changes the Spoken Content voice, the cache keeps serving the pre-toggle bytes — the action key is unchanged, so early cutoff never re-renders. "The bytes follow a Settings toggle" is true at render time; at rebuild time the artifact follows nothing until text/voice/rate changes. For scratch vocals that's fine and arguably even desirable (the take you liked survives the toggle), but a clause in build-graph.md's caveat would spare someone the "I changed my Mac's voice and the build didn't" puzzle. Fold it into the schema-split PR's doc pass rather than another commit here.
Ready for Justin's merge.
`src/schema/schemas.ts` had grown to 565 lines doing ten files' work. It's now one file per project-file domain — `common` (slug, musical time shapes, sample rates), `manifest`, `song` (song + tempo + arrangement), `assets`, `effects` (params + inserts), `targets` (the rule union), `mix`, `track` (clip/loop), `take`, `generation` — with **`schema/index.ts` as the barrel**, so consumers keep a single import path (all 18 importers repointed `schemas.js` → `index.js`, nothing else about them changes). A pure move: every schema, comment, and KeyOrder is verbatim. The only visibility change is that shared building blocks (`ticks`, `samples`, the musical-time shapes, effect param objects) are now exported from their modules, since the domains import them across files. Also carries the two non-blocking footnotes from the #27 scoped review, as that review suggested: - **Precision**: "Siri voices are hidden from `say -v` entirely" is now stated as what the probing actually established — the *system-selected* Siri voices match no nameable entry (a few Siri-branded regional voices do list), and nothing is literally named "Siri" for the magic string to shadow. Fixed in build-graph.md and the rule comment. - **The cache edge**: build-graph.md now says plainly that the cache doesn't watch Settings — after a toggle, `voice: Siri` renders keep serving pre-toggle bytes until `text`/`voice`/`rate` changes the key — and why that's also the feature (a good render survives voice drift until the recipe itself moves). Typecheck clean, 222 tests pass. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Structural refactor with no schema semantics change; risk is limited to import-path mistakes or accidental export drift, mitigated by unchanged tests and verbatim schema move. > > **Overview** > Replaces the single **`schemas.ts`** (~545 lines) with **one module per project-file domain** (`common`, `manifest`, `song`, `assets`, `effects`, `targets`, `mix`, `track`, `take`, `generation`) and a **`schema/index.ts` barrel** so the public import path stays **`../schema/index.js`**. All consumers that imported **`schemas.js`** are repointed to **`index.js`**; schemas, KeyOrders, and comments are otherwise unchanged aside from exporting shared pieces (e.g. **`ticks`**, effect param objects) where cross-file imports need them. > > **Docs and `say` rule comments** are tightened for **`voice: Siri`**: system-selected Siri voices are not nameable via **`say -v`** (only some regional Siri-branded names list), and **`build-graph.md`** now states that the cache does not watch Settings—existing **`Siri`** renders keep pre-toggle bytes until **`text`/`voice`/`rate`** change the action key, which is intentional stability against voice drift. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 5bd4e9f. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
…first (#29) Docs-only: the plan for voice generation, recording the design from our discussions before the worker gets built — merging this is the design sign-off for chunk 1. The decisions ([voice-generation.md](docs/projects/all/voice-generation.md)): 1. **A generation workflow, not a build rule** — model inference isn't reproducible across GPU/framework versions, so outputs commit with recipes (the ACE pattern); `say` stays the hermetic scratch tier. The determinism boundary we recorded with #27, now with both sides built. 2. **Local-first**: Chatterbox / Qwen3-TTS / CosyVoice 3 sit within ~80 ELO of ElevenLabs; ElevenLabs is at most a future optional keyed backend. 3. **A voice is a committed reference asset** (~3–10 s recording, content-hashed in the recipe) — better provenance than a vendor voice ID, and "sing it in my voice" becomes a recording, not an integration. 4. **A second worker, `bloom-voiced`, on the established protocol** — ace-generation.md built the worker protocol so ACE would be "the first client, not a special case"; voice is the second client, its own process for independent model memory and lifecycle. (New call, flagging for review.) 5. **Chatterbox first** — MIT, zero-shot cloning, MPS-capable; other models are backends behind the same job spec. 6. **Recipes reuse the generation schema** (optional `text`/`voice_ref` fields) so variants, hashes, `chosen`, and promotion tooling work unchanged. (New call, flagging for review.) Chunks: (1) worker + CLI + schema + tests; (2) field — record/pick a reference voice (the one open question that's genuinely yours), generate creek's line, choose, clip. Also: now.md swaps the shipped say line for this project; next.md's voice-generation entry graduates into the plan. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Documentation and project-tracking only; no runtime, schema, or worker code changes in this PR. > > **Overview** > **Docs-only design sign-off** for voice generation before chunk 1 implementation. > > Adds **`docs/projects/all/voice-generation.md`**, recording six decisions: generation workflow (ACE-style committed recipes, not a hermetic build rule), local-first open models with Chatterbox first, voices as content-hashed reference assets, a separate **`bloom-voiced`** worker on the existing NDJSON daemon protocol (not another model inside `bloom-aced`), and extending the existing **`generation/*.yaml`** schema with optional `text` / `voice_ref` rather than a parallel recipe kind. Defines done for creek’s lead vocal, two implementation chunks (worker + CLI + schema vs field recording/choose/clip), and open questions on reference voice and CLI naming. > > **Project list churn:** **`now.md`** replaces the shipped **`say` build rule** line with an in-flight voice generation entry; **`next.md`** drops the one-line voice generation teaser now that the full plan exists. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit a8d267f. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
macOS
saybecomes a build rule — the deterministic, local, keyless side of the voice boundary (voice generation with cloned/sung voices stays a separate ACE-style workflow, per next.md).text/voice/rateare the whole action key; the output is a WAV at the project rate (viaafconvert), cached and never committed.Two decisions worth reviewing:
voiceis required, and the rule verifies it before rendering.saynever rejects a voice name — probing showed it silently renders with the user's default voice on a bad name, exit 0. That is exactly the under-specified-recipe failure a required voice exists to prevent: two Macs, same action key, different audio. The rule checks the name againstsay -v '?'(exact match) and errors with the fix. The check runs at execute time, notbloom check— check's verdict must not depend on this machine's voice inventory.saythrough-f, never argv — lyrics are data; a line starting with-must not become a flag.Reproducibility is same-machine like sc-render's: an OS or voice-data update may change the bytes, and the key deliberately does not chase OS versions — recipe-reproducibility (build-graph.md "Determinism policy", which now documents the rule).
Tests (real
say+afconvert, macOS like the sclang tests): renders at project rate, byte-determinism across runs, dash-leading text, bad-voice error naming the voice, and graph integration (build → cache hit → re-key on text edit). 221 pass, typecheck clean.After merge: creek's committed scratch-vocal WAV becomes a
saytarget in field. Next PR up immediately after this one: splittingsrc/schema/schemas.tsinto per-domain files (Justin's request) — kept out of this diff so the refactor reviews on its own.Note
Low Risk
New optional rule on macOS with no changes to existing rules; failures are localized to
saytargets and non-macOS environments lack the binaries.Overview
Adds a
saybuild rule so scratch vocals and lyrics can be recipes in the graph (likesc-render), not committed WAVs. Targets declaretext, requiredvoice, and optionalrate; those fields form the action key, outputs are cached and never committed.Execution runs macOS
say(text via-fso leading dashes aren’t flags), thenafconvertto a project-rate WAV.voiceis validated againstsay -v ?at execute time—not atbloom check—becausesaysilently uses the default voice on bad names, which would break recipe identity across machines.Docs record the rule in build-graph, move the work line to now, and drop the duplicate next entry (voice generation stays separate). Tests cover rate, determinism, graph cache/re-key, and macOS-only integration.
Reviewed by Cursor Bugbot for commit fd968b5. Configure here.