Skip to content

Give a voice recipe two knobs for how the line is delivered - #65

Merged
ninjudd merged 2 commits into
mainfrom
voice/pacing
Aug 8, 2026
Merged

ninjudd merged 2 commits into
mainfrom
voice/pacing

Conversation

@ninjudd

@ninjudd ninjudd commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Give a voice recipe two knobs for how the line is delivered

Stacked on #64.

creek's take reads its line at one fixed pace and there was no way to change it: the voice job was text, seed, variants and voice_ref, so the only lever was the words. Chatterbox has six sampling parameters; two are exposed here and four are not, because a field added to the recipe is a permanent part of the committed format.

Measured before naming anything, same seed and text as the committed take. Lowering cfg_weight from 0.5 to 0.3 changed the delivery and not the pacing at all — different audio, identical 72 tokens. Only at 0.2 did the model start taking longer to say the same sentence (2.90 s of speech against 2.58 s), and exaggeration at 0.3 was stronger still at 3.10 s. The extra length is speech rather than silence: leading and trailing silence stay within 0.12–0.20 s throughout. So pacing moves by up to about a fifth, and exaggeration is the better lever, which makes sense — it is a conditioning input the model receives, where cfg_weight only reweights sampling.

cfg_weight is called conviction here. The name is the whole of the classifier-free guidance step: each token, the model predicts once knowing the text and voice and once deliberately ignorant of them, and the weight says how far past the informed prediction to push — logits = cond + w * (cond - uncond). Higher commits harder to the on-text reading and hurries; lower lingers. speed would promise what the measurement shows it does not deliver, and looseness would invert the scale so a value copied from Chatterbox's docs meant its opposite. The direction is kept identical to Chatterbox's, and adapter.py does the translation, which is what a quarantined boundary module is for.

Absent means the model's default rather than a default we chose: neither field is written unless it was asked for, and the adapter passes only what it was given. Recording 0.5 explicitly would look identical today and silently pin it if Chatterbox ever moved. The bounds are narrower than the model's and enforced three times — CLI parser, worker job spec, schema — because widening a range later leaves every committed recipe valid and narrowing one does not.

One thing worth recording that fell out of the measurement: the default run reproduced the committed take byte for byte, matching the sha256 the recipe already pins. §1.1 commits outputs because inference does not reproduce across GPU and framework versions, and that stands — but within one fixed environment the seed does exactly what the recipe implies.


Note

Medium Risk
Changes the permanent generative recipe format and the voice generation path, but validation is layered and absent knobs preserve backward compatibility for existing recipes.

Overview
Voice generation can now tune how a line is delivered, not just the text and reference. field generate accepts --exaggeration (0.25–2) and --conviction (0.1–1); both are voice-only and rejected on music prompts like --voice-ref.

conviction is the recipe and wire name for Chatterbox’s cfg_weight; adapter.py maps it at the model boundary so committed YAML and the protocol stay musician-facing. Unset knobs are omitted from the job, recipe, and model.generate call so defaults are not silently pinned if the library changes.

Bounds are enforced in the CLI parsers, worker optional_number, and generativeSoundSchema (narrower than the model’s range). Tests cover end-to-end stub wiring, schema kind-split, and live daemon rejection of out-of-range values.

docs/projects/all/voice-generation.md §8 records the measurement rationale and naming decision.

Reviewed by Cursor Bugbot for commit f92ee53. Configure here.

@ninjudd

ninjudd commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

Starting review of f92ee53.

@ninjudd ninjudd left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed f92ee53 (the PR-scoped range b520227..f92ee53, since this is stacked on #64). One finding, P3 and cosmetic. The substance holds up everywhere I could check it.

The three bound declarations agree exactly — CLI [0.25, 2] / [0.1, 1], optional_number(…, 0.25, 2.0) / (…, 0.1, 1.0), and z.number().min(0.25).max(2) / .min(0.1).max(1) — so the "enforced three times" claim is literally true rather than approximately. optional_number rejects bool before the range test, which matters because True would otherwise pass as 1 and land in a recipe as a number nobody typed.

The kwargs the adapter forwards are the real ones. ChatterboxTTS.generate in 0.1.7 takes (text, repetition_penalty, min_p, top_p, audio_prompt_path, exaggeration, cfg_weight, temperature), so **knobs with exaggeration and cfg_weight binds correctly — and that signature is also where §8's "six sampling parameters, two exposed" checks out exactly: six besides text and audio_prompt_path, two forwarded. One thing that reads as luck but isn't: generate branches on if cfg_weight > 0.0 to decide whether classifier-free guidance runs at all, so a floor of 0.1 keeps every reachable conviction on the CFG path rather than silently crossing into a different algorithm at the bottom of the range.

The knobs also compose correctly with #64's restore. With no voice_ref, each variant restores the builtin before generate rebuilds conds.t3 with the new emotion_adv (tts.py:225-230), so variant 2 starts from the same conditionals as variant 1 rather than from variant 1's rebuild — and that rebuild drops clap_emb and cond_prompt_speech_emb, so without the per-variant restore the variants would not have been siblings. With a voice_ref, prepare_conditionals already receives the exaggeration and the equality check at 225 short-circuits.

§8 is a real section, appended last as the docs convention requires, and its content matches what the code comments cite it for. Nothing generated needs regenerating: gen:limits reads normalizeSoundSchema, effects and common, not generativeSoundSchema, and no JSON Schema for recipes is committed.

On verification: pnpm typecheck and pyright src in both Python packages are clean at this exact head — I ran those while it was checked out. I did not run vitest locally against f92ee53, because the working tree moved to another branch partway through; CI's Linux job on this head reports 33 files passing with generate.test.ts at 21, client.test.ts at 9 and generative.test.ts at 9, so the new blocks ran rather than skipped.

Comment thread src/cli.ts Resolved
@ninjudd

ninjudd commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

Starting review of cf67082.

Base automatically changed from voice/first-real-run to main August 8, 2026 06:39
ninjudd added 2 commits August 7, 2026 23:39
Stacked on #64.

creek's take reads its line at one fixed pace and there was no way to change it: the voice job was text, seed, variants and `voice_ref`, so the only lever was the words. Chatterbox has six sampling parameters; two are exposed here and four are not, because a field added to the recipe is a permanent part of the committed format.

Measured before naming anything, same seed and text as the committed take. Lowering `cfg_weight` from 0.5 to 0.3 changed the delivery and not the pacing at all — different audio, identical 72 tokens. Only at 0.2 did the model start taking longer to say the same sentence (2.90 s of speech against 2.58 s), and `exaggeration` at 0.3 was stronger still at 3.10 s. The extra length is speech rather than silence: leading and trailing silence stay within 0.12–0.20 s throughout. So pacing moves by up to about a fifth, and `exaggeration` is the better lever, which makes sense — it is a conditioning input the model receives, where `cfg_weight` only reweights sampling.

`cfg_weight` is called `conviction` here. The name is the whole of the classifier-free guidance step: each token, the model predicts once knowing the text and voice and once deliberately ignorant of them, and the weight says how far past the informed prediction to push — `logits = cond + w * (cond - uncond)`. Higher commits harder to the on-text reading and hurries; lower lingers. `speed` would promise what the measurement shows it does not deliver, and `looseness` would invert the scale so a value copied from Chatterbox's docs meant its opposite. The direction is kept identical to Chatterbox's, and `adapter.py` does the translation, which is what a quarantined boundary module is for.

Absent means the model's default rather than a default we chose: neither field is written unless it was asked for, and the adapter passes only what it was given. Recording 0.5 explicitly would look identical today and silently pin it if Chatterbox ever moved. The bounds are narrower than the model's and enforced three times — CLI parser, worker job spec, schema — because widening a range later leaves every committed recipe valid and narrowing one does not.

One thing worth recording that fell out of the measurement: the default run reproduced the committed take byte for byte, matching the sha256 the recipe already pins. §1.1 commits outputs because inference does not reproduce across GPU and framework versions, and that stands — but within one fixed environment the seed does exactly what the recipe implies.
The list was strictly sorted and inserting `parseConviction` and `parseExaggeration` after `parseBpm` put C-o-n and E-x ahead of C-h-a. Nothing in the repo enforces this — no ESLint, no formatter, and typecheck, build, test and pyright are all indifferent — so the invariant survives only by being noticed, which is the argument for restoring it rather than shrugging.
@ninjudd

ninjudd commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

Reviewed 490d31d — no findings. The import-order finding is fixed: the list now reads parseBars, parseBpm, parseChannels, parseConviction, parseDurationSeconds, parseExaggeration, parseSeed, parseVariantNumber, parseVariants, sorted throughout rather than only around the insertion.

Three heads landed while this was in flight — f92ee53, cf67082, e115122 — so it is worth being exact about what was checked where, rather than implying one review covered all of them.

The substance was reviewed at f92ee53 and nothing in it has changed since. cf67082 was a rebase onto acd80e9: its PR-scoped range is byte-identical to f92ee53's apart from blob hashes and one hunk offset, which moved because #64's docstring grew by 20 lines above it. e115122 added only the import reorder. 490d31d rebased onto main after #64 merged, and the only file in the whole tree that differs from e115122 is .github/workflows/ci.yml, which now matches main exactly — that is #63's merged content arriving through the base, not a change here.

So the verification carries: pnpm typecheck is clean and pyright src is clean in both Python packages, and generate.test.ts, generative.test.ts and client.test.ts run 39 passed locally at e115122, whose contents for every one of this PR's twelve files are identical to the head. The new blocks ran rather than skipped.

From the pass at f92ee53, the parts worth restating because they are what the change rests on. The three bound declarations agree exactly — CLI [0.25, 2] / [0.1, 1], optional_number(…, 0.25, 2.0) / (…, 0.1, 1.0), and z.number().min(0.25).max(2) / .min(0.1).max(1) — so "enforced three times" is literally true. optional_number rejects bool before the range test, which matters because True would otherwise pass as 1 and reach a recipe as a number nobody typed. ChatterboxTTS.generate in 0.1.7 really does take exaggeration and cfg_weight, so **knobs binds, and its signature is also where §8's "six sampling parameters, two exposed" checks out exactly. And generate branches on if cfg_weight > 0.0 to decide whether classifier-free guidance runs at all, so a floor of 0.1 keeps every reachable conviction on the CFG path instead of crossing into a different algorithm at the bottom of the range.

The knobs compose correctly with the restore that #64 fixed. Without a voice_ref, each variant restores the builtin before generate rebuilds conds.t3 with the new emotion_adv — and that rebuild drops clap_emb and cond_prompt_speech_emb, so without the per-variant restore the variants would not have been siblings. With one, prepare_conditionals already receives the exaggeration and the equality check short-circuits.

The thread stays yours to resolve.

@ninjudd
ninjudd merged commit 16d8c42 into main Aug 8, 2026
3 checks passed
ninjudd added a commit that referenced this pull request Aug 8, 2026
Install the shared lifecycle editable, not as a copy

`field-worker` is our own source rather than a pinned release, but each
worker declared it as a plain path dependency — and uv installs those as
a copy. So the moment #65 added `optional_number` to
`field_worker.protocol`, every worker venv held a `field_voiced` reading
from the source tree and a `field_worker` frozen at whatever the last
sync captured.

The failure is worse than the cause. The daemon died at startup with
`ImportError: cannot import name 'optional_number' from
'field_worker.protocol'`, pointing at the module that wanted the symbol
rather than the stale copy that lacked it, and the CLI reported it as
`field-voiced did not start — run field setup voiced`. That advice is
wrong twice over: setup had been run, and running it again would not
have helped, because `uv sync` does not reinstall a path dependency
whose version has not changed.

Found by a generation failing on bloom, which is the only place it could
be found: nothing in this repo imports `field_worker` through an
installed venv. The regression test asserts the declaration rather than
the installed layout — the venvs are ambient and CI has none while `pnpm
test` runs, and the declaration is the thing that was actually wrong.

Both workers get it. aced had the same latent break and would have hit
it the next time the lifecycle grew anything.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Packaging and test-only changes to how the shared worker package is
linked; no runtime logic, auth, or data paths.
> 
> **Overview**
> **`field-worker`** is local source, but **aced** and **voiced** had it
as a plain path dependency, so **uv** copied a snapshot into each worker
venv. After lifecycle changes (e.g. new symbols in `field_worker`),
workers could import stale code while the tree was current—startup
**ImportError**s pointed at the consumer module, and re-running setup
did not help because **uv sync** skips reinstall when the dependency
version is unchanged.
> 
> Both workers now declare **`field-worker = { path = "../worker",
editable = true }`** with inline comments explaining why; lockfiles
record **editable** instead of **directory**. A **Vitest** regression in
`setup.test.ts` asserts every worker that depends on **`field-worker`**
includes **`editable = true`** in **`pyproject.toml`**
(declaration-only, so CI without venvs still catches a wrong line).
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
0360aca. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
ninjudd added a commit that referenced this pull request Aug 8, 2026
A worker that parses a job by reading the keys it knows will ignore the
rest, which is the friendliest possible failure and the wrong one here.
Dropping an unrecognised field *succeeds* — and the recipe written
afterwards then records an input the model never received, which is the
provenance-that-lies failure the whole commit-the-output design exists
to prevent.

Found by living it earlier today. `field generate --exaggeration 0.3`
reached a field-voiced daemon started before #65 taught it the field.
Nothing was malformed, so it generated at default pacing, and only
killing the process stopped a take landing in bloom under a recipe
claiming 0.3. The daemon-lite lifecycle exists so a model loads once and
the process outlives many jobs, which means the long-lived daemon is by
construction the one most likely to be older than the CLI talking to it
— "it was already running" is the normal case, not an edge one.

`reject_unknown` refuses any request key the job spec does not declare.
That is render-pipeline.md decision 6's fail-closed rule applied to the
wire instead of to plans, and both workers inherit it from the shared
lifecycle — the third thing #59's extraction has paid for.

The allowed set derives from the job dataclass's own fields rather than
sitting beside them as a list. On both workers the field names *are* the
wire keys, so a field added to the spec cannot be forgotten here, and
this check can never become the reason a valid request is refused. That
is load-bearing rather than tidy: mutating it to a hardcoded set makes
the existing delivery-knobs test fail, because `exaggeration` stops
being allowed.

What it cannot fix: a daemon predating this change still ignores what it
does not know, since the code that would refuse is the code it lacks.
This protects every field added from here on, which is the half that was
going to bite us again.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes wire validation for both generation workers; behavior is
fail-closed on unknown keys (good for provenance) but can break clients
that sent extra fields that were previously ignored.
> 
> **Overview**
> Workers no longer **silently ignore** request keys outside the job
dataclass spec. **`reject_unknown`** in shared `field_worker.protocol`
compares the wire payload to dataclass field names plus `id`/`op`, and
**`ValueError`** rejects anything extra before generation runs—so
recipes cannot record parameters the model never saw (e.g.
**`exaggeration`** on an older field-voiced daemon).
> 
> **field-aced** and **field-voiced** call it at the start of
**`GenerateJob.from_request`** / **`VoiceJob.from_request`**. Live
client tests assert refusal for **`guidance_scale`** and
**`temperature`** while the daemon keeps serving.
> 
> Docs add ace-generation.md §7 on the provenance failure and that
already-running daemons without this code are unchanged.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
dc23bcd. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
ninjudd added a commit that referenced this pull request Aug 10, 2026
nested-tracks is Active — chunk 4 is revived by #123 and the soak
holds either way; Shipped was the one indefensible value. The three
stale prose lines are updated to what actually happened (voice
generation through #64/#65 and the #113 fold, effects through #14/#15
with the §6 executor move, musical time through #24), so the keyword
and the prose agree on day one. The README claims adoption, not
sharing, while agent-config#15 is still open.
@ninjudd
ninjudd deleted the voice/pacing branch September 28, 2026 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant