Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 9570a1cd9357c4ba8f8bebdae7f08cedc1f977a0
parent ce1aa2d32e4f83f0ace8d51d317dbd09be5d7d1a
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Mon, 16 Nov 2026 08:42:03 -0500

umtool cast: a re-read keeps the take's own tuning and reading; the narrate signature lists them

rereadPlan's argv for a single take now carries its non-default tuning
and its reading (readTuning.mjs tuningArgvOf: --reading N and a flag for
each value off Orpheus's defaults), as it carries a take's own --speed; a
thread read's is unchanged. TUNING_FLAGS moves to readTuning.mjs, shared
by the narrate CLI and the cast. `umtool help`'s posts narrate signature
lists --reading and the tuning flags (docs/cli.md is current: the usage
block is not in it).

Co-Authored-By: Claude <noreply@anthropic.com>

Diffstat:
Mumtool/lib/cli/groups.mjs | 4+++-
Mumtool/lib/report/cast.test.mjs | 18++++++++++++++++++
Mumtool/lib/report/castProject.mjs | 6++++--
Mumtool/lib/report/postNarrationCli.mjs | 7+++----
Aumtool/lib/report/readTuning.mjs | 24++++++++++++++++++++++++
5 files changed, 52 insertions(+), 7 deletions(-)

diff --git a/umtool/lib/cli/groups.mjs b/umtool/lib/cli/groups.mjs @@ -1031,7 +1031,9 @@ export const GROUPS = [ " a re-run adds only posts not already in the cut", " umtool posts set-item <project> <item> [hold=<s>|off] [layout=sequence|grid] [redact=on|off|auto] [media.<i>.start=<s>]", " [media.<i>.end=<s>] [media.<i>.mute=on|off] [media.<i>.crop=x,y,w,h|off] [media.<i>.push=on|off] [--json]", - " umtool posts narrate <project> [--import | --list | <item> [--script \"…\"] [--take [--note \"…\"]] [--pick n] [--approve] [k=v …]", + " umtool posts narrate <project> [--import | --list | <item> [--script \"…\"] [--take [--note \"…\"] [--reading n]", + " [--temperature t] [--top-p p] [--top-k k] [--min-p m] [--repeat-penalty r] [--chunk-takes n]]", + " [--pick n] [--approve] [k=v …]", " | --all --draft-scripts | --all --take | --cut k=v …] a post read aloud (its takes: the editor's tts or yours)", " umtool posts narrate <project> <item> --take --thread [--parents 0|all] [--skip-parent <id>]… [--no-quoted]", " [--voice-for <handle>=<voice>]… [--dry-run] [--json] a THREAD READ: its context and his words in date", diff --git a/umtool/lib/report/cast.test.mjs b/umtool/lib/report/cast.test.mjs @@ -243,6 +243,24 @@ test("rereadPlan: a thread read's own options kept, the changed author's overrid assert.equal(plan.skipped[0].id, "p-8"); }); +test("rereadPlan: a single take's own tuning and reading are asked again (lane orpheus-tuning); defaults and thread reads add nothing", () => { + const made = (o) => ({ temperature: 0.55, top_p: 0.85, top_k: 50, min_p: 0, repeat_penalty: 1.2, takes: 3, ...o }); + const m = { timeline: [ + { type: "post", id: "p-1", handle: "x", narration: { takes: [{ file: "a.wav", engine: "orpheus", voice: "zac", tuning: made({ temperature: 0.7 }), reading: 2 }], pick: 0 } }, + { type: "post", id: "p-2", handle: "x", narration: { takes: [{ file: "b.wav", engine: "orpheus", voice: "zac", tuning: made({}), reading: 0 }], pick: 0 } }, + { type: "post", id: "p-3", handle: "x", narration: { takes: [{ file: "c.wav", engine: "orpheus", voice: "zac", speed: 1.2, speedAsked: true, tuning: made({ top_k: 40, takes: 5 }), reading: 0 }], pick: 0 } }, + { type: "post", id: "p-4", handle: "x", narration: { takes: [{ file: "d.wav", engine: "orpheus", voice: "zac", tuning: made({ temperature: 0.9 }), reading: 3, read: { kind: "thread" } }], pick: 0 } }, + ] }; + const drift = (id, thread = false) => ({ id, handle: "x", role: "post", reads: "orpheus:zac", want: "orpheus:leah", kind: "tts", thread }); + const plan = rereadPlan("p", m, [drift("p-1"), drift("p-2"), drift("p-3"), drift("p-4", true)], ["x"]); + assert.deepEqual(plan.items.map((x) => x.argv.slice(4)), [ + ["--take", "--reading", "2", "--temperature", "0.7"], + ["--take"], + ["--take", "--speed", "1.2", "--top-k", "40", "--chunk-takes", "5"], + ["--take", "--thread"], + ]); +}); + test("an audition: candidates checked, synthesized once, levelled, scored for closeness to the real voice", async () => { assert.throws(() => candidatesOf(["/home/me/voice.wav"]), /never a candidate/); assert.throws(() => candidatesOf(["a", "b", "c", "d", "e", "f", "g"].map((v) => `kokoro:${v}`)), /at most 6/); diff --git a/umtool/lib/report/castProject.mjs b/umtool/lib/report/castProject.mjs @@ -13,6 +13,7 @@ import { shownNameOf, speakerFor, takeReads, voiceDrift, ENGINE_WEIGHT, } from "umtool-report-to-video/cast"; import { characterLines } from "./castAudition.mjs"; +import { tuningArgvOf } from "./readTuning.mjs"; const str = (v) => (typeof v === "string" ? v : ""); @@ -220,9 +221,10 @@ export function rereadPlan(projectId, manifest, drift, handles) { const takes = e?.narration?.takes ?? []; const t = takes[Number.isInteger(e?.narration?.pick) ? e.narration.pick : 0] ?? null; // A single take's own speed is asked again -- an old read never comes back at another speed -- unless it came - // from the character's preset or the item (that is what a re-read takes anew). + // from the character's preset or the item (that is what a re-read takes anew). Its own tuning and reading too + // (readTuning.mjs: what is not Orpheus's default) -- a reading picked by ear is read again the same way. const keepSpeed = !r.thread && typeof t?.speed === "number" && t.speed !== 1 && t.speedAsked !== "preset" && t.speedAsked !== "item"; - const argv = ["posts", "narrate", projectId, r.id, "--take", ...(r.thread ? ["--thread", ...threadArgvOf(t?.read, { handles: [...want], author: e?.handle, takes })] : keepSpeed ? ["--speed", String(t.speed)] : [])]; + const argv = ["posts", "narrate", projectId, r.id, "--take", ...(r.thread ? ["--thread", ...threadArgvOf(t?.read, { handles: [...want], author: e?.handle, takes })] : [...(keepSpeed ? ["--speed", String(t.speed)] : []), ...tuningArgvOf(t)])]; return { ...r, take: t?.file ?? null, argv }; }); return { items, skipped }; diff --git a/umtool/lib/report/postNarrationCli.mjs b/umtool/lib/report/postNarrationCli.mjs @@ -36,6 +36,7 @@ import { projectRedaction } from "./postRedaction.mjs"; import { readManifest } from "../projects/report.mjs"; import { withEditNotes } from "./edit-guard.mjs"; import { manifestToken, updatePostNarration, updatePostNarrationRender, updatePostNarrations } from "./manifest.mjs"; +import { TUNING_FLAGS } from "./readTuning.mjs"; import { TTS_TUNING_FIELDS, quantizeTtsTuningValue, ttsReadingError, ttsTuningValueError } from "yt-dlp-transcript-common/lib/ttsTuning.mjs"; const execFileP = promisify(execFile); @@ -466,10 +467,8 @@ export function tunedOfResult(result) { }; } -/** The flags that make a read's tuning, and the tuning field each sets. */ -export const TUNING_FLAGS = Object.freeze({ - "--temperature": "temperature", "--top-p": "top_p", "--top-k": "top_k", "--min-p": "min_p", "--repeat-penalty": "repeat_penalty", "--chunk-takes": "takes", -}); +// The flags that make a read's tuning (readTuning.mjs, which the cast's re-reads share). +export { TUNING_FLAGS } from "./readTuning.mjs"; /** * `--reading N` and the tuning flags as a take asks them: `{ tuning, reading, flags }` (the flags given), or null when diff --git a/umtool/lib/report/readTuning.mjs b/umtool/lib/report/readTuning.mjs @@ -0,0 +1,24 @@ +// A READ's Orpheus tuning and reading as umtool's words (lane orpheus-tuning): the flags `umtool posts narrate <p> +// <item> --take` takes for them, and the flags that ask a take's own again -- what a re-read keeps, as it keeps a +// take's own --speed. The ranges and the defaults are the editor's (yt-dlp-transcript-common/lib/ttsTuning.mjs). +// +// Plain ESM, pure. +import { ORPHEUS_DEFAULT_TAKES, normalizeTtsTuning } from "yt-dlp-transcript-common/lib/ttsTuning.mjs"; + +/** The flags that make a read's tuning, and the tuning field each sets. */ +export const TUNING_FLAGS = Object.freeze({ + "--temperature": "temperature", "--top-p": "top_p", "--top-k": "top_k", "--min-p": "min_p", "--repeat-penalty": "repeat_penalty", "--chunk-takes": "takes", +}); + +/** + * The flags that ask a take's tuning and reading again: `--reading N` when it was not the first reading, and a flag + * for each tuning value that is not Orpheus's default (the take records every value; `takes` against the settings' + * default). `[]` for a take made with the defaults, or one that records neither (another engine, an older take). + */ +export function tuningArgvOf(take) { + const a = []; + if (Number.isInteger(take?.reading) && take.reading > 0) a.push("--reading", String(take.reading)); + const off = normalizeTtsTuning(take?.tuning, { takes: ORPHEUS_DEFAULT_TAKES }); + for (const [flag, field] of Object.entries(TUNING_FLAGS)) if (off[field] !== undefined) a.push(flag, String(off[field])); + return a; +}