commit e39a3216b0877232d907121210f3d7ff83e6b6e1
parent 1f2944ac135e4e65de8f701d5ee5669ee8207281
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Fri, 6 Nov 2026 22:03:59 -0500
umtool e2e: the Voices page -- characters and their voices, an audition rendered and scored, Use everywhere and the re-read queued and made, Use for this project as an override, the cast's undo, a recording converted
voices-fixture: Host's clips (the real voice, speakers.json), @hostman's items (one read in orpheus
zac), @guest's. The panel keeps an audition open when its character joins the cast.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
4 files changed, 279 insertions(+), 0 deletions(-)
diff --git a/umtool/components/projects/VoicesPanel.tsx b/umtool/components/projects/VoicesPanel.tsx
@@ -84,6 +84,13 @@ export default function VoicesPanel({ project, posts, initialWho = null }: { pro
}, [load]);
const chosen = useMemo(() => view?.characters.find((c) => whoOf(c) === who) ?? null, [view, who]);
+ // A character that joined (or left) the cast keeps its audition open: the same handle, its new key.
+ useEffect(() => {
+ if (!view || !who || chosen) return;
+ const h = who.replace(/^@/, "");
+ const row = view.characters.find((c) => c.handles.includes(h) || c.character?.id === h);
+ if (row) setWho(whoOf(row));
+ }, [view, who, chosen]);
// A character picked: its voice now is the first candidate.
useEffect(() => {
if (!chosen) return;
diff --git a/umtool/e2e/fixtures/make-fixture.mjs b/umtool/e2e/fixtures/make-fixture.mjs
@@ -37,6 +37,7 @@ import { makeBenchShellFixture } from "./bench-shell-fixture.mjs";
import { makeTakeWalkFixture } from "./take-walk-fixture.mjs";
import { makeCutIntegrityFixture } from "./cut-integrity-fixture.mjs";
import { makeUiOpsFixture } from "./ui-ops-fixture.mjs";
+import { makeVoicesFixture } from "./voices-fixture.mjs";
import { makeYoutubeFixture } from "./youtube-fixture.mjs";
import { makeBoardFixture, makeResearchFixture } from "./research-fixture.mjs";
import { makeCaseStagesFixture } from "./case-stages-fixture.mjs";
@@ -1903,6 +1904,8 @@ makeTakeWalkFixture({ reports, manifest, cachedWindow: path.join(REPORT, "out",
makeCutIntegrityFixture({ reports, manifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4") });
// ui-ops.spec's own project and channels (UI notes #9 #10 #15 #18).
makeUiOpsFixture({ reports, channels: CHANNELS, manifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4"), ff });
+// The Voices page (voices.spec.ts): Host's clips (the real voice) and post items by @hostman and @guest.
+makeVoicesFixture({ reports, channels: CHANNELS, manifest, ff });
// Release 28 M6: the YouTube text, previewed and built (media-draft-e.spec.ts).
makeYoutubeFixture({ reports, manifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4") });
// Release 36 lane D: the assistant's labels, Suggest, Ask and Apply in the clip editor (clips-suggest.spec.ts).
diff --git a/umtool/e2e/fixtures/voices-fixture.mjs b/umtool/e2e/fixtures/voices-fixture.mjs
@@ -0,0 +1,63 @@
+// THE VOICES PAGE (voices.spec.ts; lib/report/castCli.mjs, components/projects/VoicesPanel.tsx): a cut of two clips
+// of "Host" (the real voice: speakers.json names them) and three post items --
+//
+// reports/voices-fixture/
+// k01, k02 Host's clips (a 150 Hz voice and its octave), each window in the corpus under voicescast
+// p-1 @hostman "Host's first line, read aloud." -- its picked take orpheus · zac (a 262 Hz tone)
+// p-2 @hostman answers @guest's post (a parent): no take yet
+// p-3 @guest "The guest's own line." -- no take yet
+// speakers.json Host: k01, k02
+//
+// The cast (<fixture>/.umtool/cast.json) is the spec's to write and remove. The editor is the suite's stub (its tts
+// writes a tone; its voice-convert copies), the speaker embedder the test kit's fake (VOICE_MATCH_* in
+// playwright.config.ts). Synthetic, like every fixture.
+import { mkdirSync, writeFileSync } from "node:fs";
+import path from "node:path";
+
+export const VOICES = "voices-fixture";
+
+const write = (dir, name, doc) => {
+ mkdirSync(dir, { recursive: true });
+ writeFileSync(path.join(dir, name), typeof doc === "string" ? doc : JSON.stringify(doc, null, 2) + "\n");
+};
+
+/** @param {{ reports: string, channels: string, manifest: Function, ff: (args: string[]) => void }} o */
+export function makeVoicesFixture({ reports, channels, manifest, ff }) {
+ const chan = "voicescast";
+ const timeline = [];
+ for (const id of ["k01", "k02"]) {
+ const vid = `voice-${id}`;
+ const vdir = path.join(channels, chan, "data", vid);
+ mkdirSync(path.join(vdir, "clips"), { recursive: true });
+ write(vdir, "transcript.cues.json", { title: `Host ${vid}`, uploadDate: "20250101", channel: "Voices Cast", webpageUrl: `https://example.invalid/watch?v=${vid}`, duration: 20, cues: [{ start: 2, end: 4.5, text: "slow news day." }] });
+ ff([
+ "-f", "lavfi", "-i", "color=c=gray:size=160x90:rate=15:duration=6",
+ "-f", "lavfi", "-i", "aevalsrc=0.3*sin(2*PI*150*t)+0.15*sin(2*PI*300*t):s=48000:d=6",
+ "-map", "0:v", "-map", "1:a", "-t", "6",
+ "-c:v", "libx264", "-pix_fmt", "yuv420p", "-c:a", "aac", "-ar", "48000", "-ac", "2",
+ path.join(vdir, "clips", "0.00-6.00.mp4"),
+ ]);
+ timeline.push({ type: "clip", id, channel: chan, video: vid, start: 0.5, end: 5.5, cutStart: 2, cutEnd: 4.5, cite: 2, section: 0, lock: true, quote: "slow news day." });
+ }
+ const dir = path.join(reports, VOICES);
+ const post = (id, handle, author, text, o = {}) => ({
+ type: "post", id: `p-${id}`, post: `voicescast-x/${id}`, platform: "x", author, handle, date: `2026-10-30T1${id}:00:00.000Z`, text,
+ url: `https://x.com/${handle}/status/${id}`, engagement: { likes: 1 }, section: 0, ...o,
+ });
+ const takes = path.join(dir, "narration", "posts", "1");
+ mkdirSync(takes, { recursive: true });
+ ff(["-f", "lavfi", "-i", "sine=frequency=262:sample_rate=48000:duration=2", "-ac", "1", "-c:a", "pcm_s16le", path.join(takes, "take-1.orpheus-zac.wav")]);
+ timeline.push(
+ post("1", "hostman", "Host Man", "Host's first line, read aloud.", {
+ narration: { script: "Host's first line, read aloud.", takes: [{ file: "narration/posts/1/take-1.orpheus-zac.wav", engine: "orpheus", voice: "zac", seconds: 2, script: "Host's first line, read aloud.", at: "2026-11-02T00:00:00.000Z" }], pick: 0 },
+ }),
+ post("2", "hostman", "Host Man", "And the host answers the guest.", {
+ parents: [{ id: "20", handle: "guest", author: "The Guest", date: "2026-10-30T09:00:00.000Z", text: "The guest asks a question first." }],
+ narration: { script: "And the host answers the guest." },
+ }),
+ post("3", "guest", "The Guest", "The guest's own line.", { narration: { script: "The guest's own line." } }),
+ );
+ write(dir, "video.manifest.json", manifest(VOICES, "The Voices Fixture", { siteOrigin: "https://archive.example", channelSlug: chan }, timeline));
+ write(dir, "speakers.json", { speakers: [{ name: "Host", clips: ["k01", "k02"] }] });
+ return dir;
+}
diff --git a/umtool/e2e/voices.spec.ts b/umtool/e2e/voices.spec.ts
@@ -0,0 +1,206 @@
+import { test, expect, type Page } from "@playwright/test";
+import { copyFileSync, existsSync, mkdirSync, readFileSync, rmSync } from "node:fs";
+import { execFileSync } from "node:child_process";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+import * as urls from "./urls";
+
+// ---------------------------------------------------------------------------
+// THE VOICES PAGE (operator, 6 Nov 2026: "pick different voices for different characters, and in UI alone be able
+// to try rendering different ones to compare … and try to maintain consistent voices for different repeating
+// characters"; components/projects/VoicesPanel.tsx, /api/report/voices, lib/report/castCli.mjs). Fixture:
+// e2e/fixtures/voices-fixture.mjs -- Host's clips (the real voice), @hostman's two items (one read in orpheus zac),
+// @guest's. Every step a press:
+//
+// the characters, each voice and where it comes from (umtool cast project)
+// Audition: candidates added, Render -> a job (the stub editor's tts, then the fake embedder's closeness),
+// played side by side at one loudness beside the real voice
+// Use everywhere -> the cast; the re-read confirm -> queued; the item re-read in the new voice
+// Use for this project -> the project's voice map; the lint's override note
+// a recording dropped on an item -> kept, converted to the character's stock voice
+// the cast: remove, undo
+// ---------------------------------------------------------------------------
+
+const HERE = path.dirname(fileURLToPath(import.meta.url));
+const FIXTURE = path.join(HERE, "..", ".e2e-song");
+const P = "reports/voices-fixture";
+const DIR = path.join(FIXTURE, "reports", "voices-fixture");
+const MANIFEST = path.join(DIR, "video.manifest.json");
+const CAST = path.join(FIXTURE, ".umtool", "cast.json");
+const SHOTS = process.env.E2E_VOICES_SHOTS ?? null;
+const REC = path.join(FIXTURE, "voices-recording.wav");
+
+type Take = { file: string; engine?: string; voice?: string; steps?: { op: string; voice?: string }[] };
+type Entry = { id: string; narration?: { takes?: Take[]; pick?: number } };
+const entry = (id: string) => (JSON.parse(readFileSync(MANIFEST, "utf8")) as { timeline: Entry[] }).timeline.find((e) => e.id === id)!;
+const picked = (id: string) => {
+ const n = entry(id).narration ?? {};
+ return (n.takes ?? [])[n.pick ?? 0] ?? null;
+};
+const shot = async (page: Page, name: string, el?: ReturnType<Page["locator"]>) => {
+ if (!SHOTS) return;
+ mkdirSync(SHOTS, { recursive: true });
+ if (el) await el.screenshot({ path: path.join(SHOTS, `${name}.png`) });
+ else await page.screenshot({ path: path.join(SHOTS, `${name}.png`), fullPage: true });
+};
+
+test.beforeAll(() => {
+ if (!existsSync(`${MANIFEST}.pristine`)) copyFileSync(MANIFEST, `${MANIFEST}.pristine`);
+ if (!existsSync(REC)) execFileSync("ffmpeg", ["-v", "error", "-y", "-f", "lavfi", "-i", "sine=frequency=500:sample_rate=48000:duration=2", "-ac", "1", REC]);
+});
+const reset = () => {
+ copyFileSync(`${MANIFEST}.pristine`, MANIFEST);
+ for (const f of [CAST, CAST.replace(/\.json$/, ".undo.json"), path.join(DIR, "narration", "voices.json")]) rmSync(f, { force: true });
+ for (const d of ["auditions", "uploads", "parts-cache"]) rmSync(path.join(DIR, "narration", d), { recursive: true, force: true });
+ for (const id of ["1", "2", "3"]) {
+ const dir = path.join(DIR, "narration", "posts", id);
+ if (!existsSync(dir)) continue;
+ for (const f of execFileSync("ls", ["-A", dir], { encoding: "utf8" }).split("\n").filter(Boolean)) if (f !== "take-1.orpheus-zac.wav") rmSync(path.join(dir, f), { recursive: true, force: true });
+ }
+ rmSync(path.join(DIR, "revisions"), { recursive: true, force: true });
+};
+test.beforeEach(() => {
+ test.setTimeout(240_000);
+ reset();
+});
+test.afterAll(reset);
+
+test("each character's voice and where it comes from; an audition side by side with its closeness to the real voice; Use everywhere and the re-reads", async ({ page }) => {
+ await page.goto(urls.voicesHref(P));
+ const host = page.locator('[data-voices-character="@hostman"]');
+ const guest = page.locator('[data-voices-character="@guest"]');
+ await expect(host).toBeVisible();
+ // Nothing in the cast yet: his own items read in the narrator's voice; the guest's too, and as a context post the default.
+ await expect(host).toHaveAttribute("data-voice-from", "narrator");
+ await expect(host.locator("[data-voice-now]")).toHaveAttribute("data-voice-now", "orpheus:zac");
+ await expect(host.locator("[data-voice-speaker]")).toHaveAttribute("data-voice-speaker", "Host");
+ await expect(host.locator("[data-voice-drift]")).toHaveAttribute("data-voice-drift", "0");
+ await expect(guest).toContainText("1 item · 1 as context");
+ await expect(guest).toContainText("as a context post: orpheus · leo (the default)");
+ await expect(page.locator("[data-cast-list]")).toHaveAttribute("data-cast-list", "0");
+ await shot(page, "1-characters");
+
+ // Audition him: his current voice is the first candidate; two Kokoro voices added from the engine's list.
+ await host.locator("[data-voices-audition-open]").click();
+ const box = page.locator('[data-audition-panel="@hostman"]');
+ await expect(box.locator('[data-audition-candidate="orpheus:zac"]')).toBeVisible();
+ await expect(box.locator("[data-audition-said]")).toContainText("Host's first line, read aloud.");
+ for (const v of ["am_michael", "bm_george"]) {
+ await box.locator("[data-audition-engine]").selectOption("kokoro");
+ await box.locator("[data-audition-voice]").selectOption(v);
+ await box.locator("[data-audition-add]").click();
+ }
+ await expect(box.locator("[data-audition-candidates]")).toHaveAttribute("data-audition-candidates", "3");
+ await expect(box.locator('[data-audition-result="kokoro:am_michael"]')).toHaveAttribute("data-audition-state", "missing");
+ await expect(box.locator("[data-audition-render]")).toHaveText("Render 3 candidates");
+ await box.locator("[data-audition-render]").click();
+ await expect(box.locator("[data-audition-job]")).toHaveAttribute("data-audition-job", "done", { timeout: 120_000 });
+ await expect(box.locator("[data-audition-results]")).toHaveAttribute("data-audition-results", "3");
+ for (const spec of ["orpheus:zac", "kokoro:am_michael", "kokoro:bm_george"]) {
+ const card = box.locator(`[data-audition-result="${spec}"]`);
+ await expect(card).toHaveAttribute("data-audition-state", "ready");
+ await expect(card.locator("[data-audition-score]")).toHaveAttribute("data-audition-score", /^-?\d\.\d{3}$/);
+ await expect(card).toContainText("closeness to Host");
+ await expect(card).toContainText(/-2\d\.\d LUFS|-19\.\d LUFS|-20\.\d LUFS/);
+ }
+ // The real voice beside them: a reference, never a target.
+ await expect(box.locator('[data-audition-reference="Host"]')).toContainText("never a target");
+ const ref = await box.locator("[data-audition-reference-audio]").getAttribute("src");
+ expect((await page.request.get(ref!)).status()).toBe(200);
+ const src = await box.locator('[data-audition-audio="kokoro:am_michael"]').getAttribute("src");
+ expect((await page.request.get(src!)).headers()["content-type"]).toBe("audio/wav");
+ // The editor was asked once a candidate, each in its own engine.
+ const asked = (JSON.parse(readFileSync(path.join(FIXTURE, "editor-stub.requests.json"), "utf8")) as { route?: string; engine?: string; voice?: string; text?: string }[])
+ .filter((r) => r.route === "tts" && r.text === "Host's first line, read aloud.");
+ expect(asked.map((r) => `${r.engine}:${r.voice}`).sort()).toEqual(["kokoro:am_michael", "kokoro:bm_george", "orpheus:zac"]);
+ await expect(box.locator("[data-audition-render]")).toHaveText("Score again");
+ await shot(page, "2-audition", box);
+
+ // Use everywhere: the cast; then the re-read his picked take (orpheus zac) asks for, confirmed and queued.
+ await box.locator('[data-audition-result="kokoro:am_michael"] [data-audition-use="cast"]').click();
+ const confirm = box.locator("[data-reread-confirm]");
+ await expect(confirm).toHaveAttribute("data-reread-confirm", "1");
+ await expect(confirm.locator('[data-reread-item="p-1"]')).toContainText("post orpheus · zac → kokoro · am_michael");
+ const cast = JSON.parse(readFileSync(CAST, "utf8")) as { characters: { id: string; voice: string; handles: string[] }[] };
+ expect(cast.characters).toEqual([{ id: "hostman", name: "Host Man", handles: ["hostman"], voice: "kokoro:am_michael" }]);
+ await expect(page.locator('[data-voices-character="hostman"]')).toHaveAttribute("data-voice-from", "cast");
+ await expect(page.locator('[data-voices-character="hostman"] [data-voice-drift]')).toHaveAttribute("data-voice-drift", "1");
+ await shot(page, "3-reread-confirm", confirm);
+ await confirm.locator("[data-reread-queue]").click();
+ await expect(box.locator("[data-reread-queued]")).toHaveAttribute("data-reread-queued", "1");
+ // The queue makes it: a new take in the cast's voice, picked (awaiting approval).
+ await expect.poll(() => picked("p-1")?.voice ?? null, { timeout: 120_000 }).toBe("am_michael");
+ expect(picked("p-1")!.engine).toBe("kokoro");
+ await page.reload();
+ await expect(page.locator('[data-voices-character="hostman"] [data-voice-drift]')).toHaveAttribute("data-voice-drift", "0");
+ await expect(page.locator('[data-cast-row="hostman"]')).toContainText("kokoro · am_michael");
+ await shot(page, "4-after-reread");
+});
+
+test("Use for this project: the project's own map, shown as an override of the cast; the cast removed and put back", async ({ page }) => {
+ await page.goto(urls.voicesHref(P));
+ const guest = page.locator('[data-voices-character="@guest"]');
+ await guest.locator("[data-voices-audition-open]").click();
+ const box = page.locator('[data-audition-panel="@guest"]');
+ // No real voice named for the guest: candidates are not scored.
+ await box.locator("[data-audition-line]").selectOption("stock");
+ await expect(box.locator("[data-audition-said]")).toContainText("you cannot make this stuff up");
+ await box.locator("[data-audition-engine]").selectOption("kokoro");
+ await box.locator("[data-audition-voice]").selectOption("af_heart");
+ await box.locator("[data-audition-add]").click();
+ await box.locator("[data-audition-render]").click();
+ await expect(box.locator("[data-audition-job]")).toHaveAttribute("data-audition-job", "done", { timeout: 120_000 });
+ await expect(box.locator("[data-audition-no-reference]")).toBeVisible();
+ await expect(box.locator('[data-audition-result="kokoro:af_heart"]')).toHaveAttribute("data-audition-state", "ready");
+ // Everywhere first (the cast), then this project's own choice over it.
+ await box.locator('[data-audition-result="kokoro:af_heart"] [data-audition-use="cast"]').click();
+ await expect(page.locator('[data-cast-row="guest"]')).toBeVisible();
+ await box.locator('[data-audition-result="orpheus:zac"] [data-audition-use="project"]').click();
+ await expect(page.locator('[data-voices-character="guest"]')).toHaveAttribute("data-voice-from", "project");
+ expect(JSON.parse(readFileSync(path.join(DIR, "narration", "voices.json"), "utf8"))).toEqual({ guest: "orpheus:zac" });
+ await expect(page.locator("[data-voices-overrides]")).toContainText("@guest reads in orpheus · zac here — the cast says kokoro · af_heart (an override on purpose)");
+ await shot(page, "5-override");
+ // The cast: removed, then put back by Undo.
+ await page.locator('[data-cast-remove="guest"]').click();
+ await expect(page.locator("[data-cast-list]")).toHaveAttribute("data-cast-list", "0");
+ await page.locator("[data-cast-undo]").click();
+ await expect(page.locator('[data-cast-row="guest"]')).toBeVisible();
+ await expect(page.locator("[data-voices-status]")).toContainText("undone: rm guest");
+});
+
+test("a recording dropped on an item: kept as recorded, converted to the character's stock voice, picked", async ({ page }) => {
+ await page.goto(urls.voicesHref(P));
+ // Put the host in the cast (Use everywhere, from an audition of his current voice: nothing to render twice).
+ await page.locator('[data-voices-character="@hostman"] [data-voices-audition-open]').click();
+ const box = page.locator('[data-audition-panel="@hostman"]');
+ await box.locator("[data-audition-render]").click();
+ await expect(box.locator("[data-audition-job]")).toHaveAttribute("data-audition-job", "done", { timeout: 120_000 });
+ await box.locator('[data-audition-result="orpheus:zac"] [data-audition-use="cast"]').click();
+ await expect(page.locator('[data-cast-row="hostman"]')).toBeVisible();
+ // The guest's item, read by the operator, made the host's voice (as Host Man).
+ const rec = page.locator("[data-recording-import]");
+ await rec.locator("[data-recording-item]").selectOption("p-3");
+ await rec.locator("[data-recording-as]").selectOption("hostman");
+ await rec.locator("[data-recording-file]").setInputFiles(REC);
+ await expect(rec).toContainText("voices-recording.wav");
+ await shot(page, "6-recording", rec);
+ await rec.locator("[data-recording-send]").click();
+ await expect.poll(() => picked("p-3")?.steps?.[0]?.op ?? null, { timeout: 120_000 }).toBe("convert");
+ const takes = entry("p-3").narration!.takes!;
+ expect(takes[0].engine).toBe("recorded");
+ expect(picked("p-3")!.steps![0].voice).toBe("orpheus:zac");
+ expect(picked("p-3")!.voice).toBe("zac");
+ await expect(page.locator("[data-voices-status]")).toContainText("p-3: the recording is in");
+ // The editor's convert was asked for a STOCK voice, never a file.
+ const conv = (JSON.parse(readFileSync(path.join(FIXTURE, "editor-stub.requests.json"), "utf8")) as { route?: string; voice?: string }[]).filter((r) => r.route === "voice-convert").at(-1)!;
+ expect(conv.voice).toBe("orpheus:zac");
+});
+
+test("the Cut tab's Reads and voices reaches the Voices page", async ({ page }) => {
+ await page.goto(urls.projectHref(P, { tab: "cut" }));
+ const { openPanel } = await import("./panels");
+ await openPanel(page, "options", "cut-reads");
+ await page.locator("[data-voices-link]").click();
+ await expect(page).toHaveURL(/\/voices$/);
+ await expect(page.locator("[data-voices-panel]")).toBeVisible();
+});