commit 47f7e7965ed31ea573b3908fef763f90e5be9122
parent 7b80e6c037976c1edd43a77bd3c5f1dff0d520a2
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 3 Nov 2026 08:57:17 -0500
voice ops: a bare stock voice is a target (zac is orpheus:zac, the shape umtool records); umtool's derive sends a voice only to convert and records the engine and voice the editor's defaults chose; docs
- parseStockTarget takes `zac`, `am_michael`, ... when exactly one TTS engine has the voice (a name two engines share must be named in full); umtool's VOICE_RE has no colon, so a take converted to `orpheus:zac` could not be written -- `--voice zac` now works end to end.
- The voice result carries `voice` beside `target`. umtool (deriveTake and the bench's route) reads it: a convert asked with no --voice records the stock voice it landed on, and a step with no --engine the engine that ran, instead of the source take's voice and "?".
- An enhance no longer sends `voice` (the route refuses the key: an enhance keeps the take's voice).
- OPERATING.md "Enhance or convert a recorded take"; umtool's report-video.md and knobs.md say which engines exist and how to install them; COMMANDS.md regenerated.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
12 files changed, 99 insertions(+), 17 deletions(-)
diff --git a/COMMANDS.md b/COMMANDS.md
@@ -171,7 +171,7 @@ Drives a running editor over HTTP (`/api/ops/*`, the same actions its pages run)
| `transcribe` | transcribe runs ONE local file through a local transcription worker, as a job: {"path": "/abs/file"} (audio or video), "start"/"end" (seconds) for a window, "workerId" (a settings worker id; default: the one auto-transcribe would get), "out" (an absolute path for the result JSON, never inside the corpus). The result is {path, window, worker: {id, appId, model, device}, cues: \[{start, end, text}\], text, ...}, cue times on the file's own clock. "words": true adds words: \[{w, start, end, conf?}\] on the same clock -- from parakeet, which keeps its word timestamps; \[\] from an engine that does not. "whilePaused": true runs it during a pause-all on a worker the pause alone switched off (never one drained, degraded or disabled by hand); the pause stays on. With --wait it is printed on stdout (the response and the log go to stderr), so `pnpm ops transcribe ... --wait \| jq -r .text` works. | `pnpm ops transcribe --json '{"path":"/abs/clip.mp4","start":120,"end":150}' --wait`<br>`pnpm ops transcribe --json '{"path":"/abs/a.wav","workerId":"parakeet-cpu","out":"/tmp/a.json"}' --wait` |
| `tts` | tts speaks a line with a local text-to-speech engine and a STOCK voice, as a job on the `tts` queue: {"text": "..."} or {"file": "/abs/script.txt"} (UTF-8, at most 20,000 characters), "engine" (kokoro \| orpheus \| espeak-ng), "voice" (one of the engine's stock voices; kokoro: af\_heart, bm\_george, ...; orpheus: leah, zac, ...), "speed" (0.5-2; orpheus has none) — defaults from settings.tts (kokoro, af\_heart, 1) — and "out" (an absolute .wav path the result is copied to, never inside the corpus). The expressive tags <laugh> <chuckle> <sigh> <cough> <sniffle> <groan> <yawn> <gasp> are performed by orpheus and stripped for the others; any other <...> is refused. Numbers, years, money and times are spoken (2024: "twenty twenty-four"). The result is {wav, seconds, engine, voice, cached, durationMs, waitedMs, sha, sampleRate, speed, disclosure}: wav is the 48 kHz mono WAV the editor wrote (out, or its cache), disclosure the line a narrated export carries. The same ask again is answered from the cache (cached: true, no engine run). Kokoro and orpheus need `archilyzer tts setup [--engine orpheus]` first; orpheus runs on the GPU (a local llama-server the editor starts and stops) and waits while a transcription holds it. With --wait the result is printed on stdout. | `pnpm ops tts --json '{"text":"In 2024 the archive spoke."}' --wait`<br>`pnpm ops tts --json '{"file":"/abs/script.txt","voice":"bm_george","out":"/abs/line.wav"}' --wait` |
| `voice-enhance` | voice-enhance cleans a speech recording up (denoise, soften the room, level it) as a job on the `voice` queue, behind the heavy slot: {"file": "/abs/take.wav", "out": "/abs/clean.wav"} (never inside the corpus; 48 kHz mono, exactly as long as the input), "engine" (deepfilternet \| rnnoise; settings.voice), "params" (the engine's knobs: lufs, highpass, attenLimDb, postFilter, mix), "parts" (\[{file, out}\], a take recorded part by part). deepfilternet needs `archilyzer voice setup --engine deepfilternet`; rnnoise needs nothing. The result is {op, engine, wav, seconds, samples, sampleRate, engineMs, durationMs, waitedMs, gainDb, params, parts?, synthetic}; with --wait it is printed on stdout. | |
-| `voice-convert` | voice-convert keeps a recording's performance (timing, pitch contour) and swaps its timbre for a STOCK synthetic voice, as voice-enhance's job: the same body plus "voice" — "<tts engine>:<stock voice>" (orpheus:zac, orpheus:leah, kokoro:am\_michael, ...; settings.voice.convert.target); a file, a path or a recording is REFUSED as a target (no real person's voice) — and "engine" (openvoice \| seed-vc, each installed by `archilyzer voice setup --engine <id>`). The target's reference is synthesized once through the tts op and kept. The result adds target, synthetic: true and the disclosure line. | |
+| `voice-convert` | voice-convert keeps a recording's performance (timing, pitch contour) and swaps its timbre for a STOCK synthetic voice, as voice-enhance's job: the same body plus "voice" — "<tts engine>:<stock voice>" (orpheus:zac, orpheus:leah, kokoro:am\_michael, ...; settings.voice.convert.target); a file, a path or a recording is REFUSED as a target (no real person's voice) — and "engine" (openvoice \| seed-vc, each installed by `archilyzer voice setup --engine <id>`). The target's reference is synthesized once through the tts op and kept. The result adds target, voice, synthetic: true and the disclosure line. | |
| `settings` | settings patches settings.json through the editor's one writer: {"patch": {"<top-level key>": value, …}} (SETTINGS.md). A block's keys merge one level; an array, a scalar or an object nested in a block replaces. Refused before anything is written: an unknown key; a key another writer owns (channelPriority, autoQueue, workers, storage — the refusal names it); a value the schema would not keep as sent (clamped, dropped), named with what would be saved. Answers the saved values. | `pnpm ops settings --json '{"patch":{"minFreeDiskGB":20}}'` |
| `clear-platform-hold` | clear-platform-hold clears a platform's rate-limit hold, backoff and raised pace, as the lane strip's Clear hold: {"platform"}. Answers the sentence. | |
| `recheck-service` | recheck-service asks a service whose cookie refresh alert is up ONE request through its own path, as the dashboard banner's Recheck: {"service"} ("rumble", "youtube", "odysee", "archive.today", "x" or a forum host). Waits for it: {jobId, result: "clean" \| "stale" \| "failed", message}; "clean" clears the alert (and a yt-dlp service's backoff, as any clean request). For "x" it sends X NO request: clean when the login on disk was renewed after the alert (Refresh cookies on /settings) — for a jar-age alert, when the jar is within social.x.maxCookieAgeMinutes. The editor also rechecks by itself on a timer (settings.serviceCookies.recheckIntervalMinutes, default 180, 0 = off; `pnpm ops settings --json '{"patch":{"serviceCookies":{"recheckIntervalMinutes":0}}}'`). dismiss-service clears a service's cookie alert by hand: {"service"}. rerun-service-jobs retries every job a service's cookie alert stopped, once it is OK again: {"service"} -> {jobIds, skipped}. --wait follows them. | `pnpm ops recheck-service --json '{"service":"rumble"}'`<br>`pnpm ops recheck-service --json '{"service":"x"}'` |
diff --git a/OPERATING.md b/OPERATING.md
@@ -766,6 +766,34 @@ pnpm ops get generation-usage
`pnpm archilyzer reports import-local-runs`) and the directory deleted (release 28). The repo's
`.claude/commands/gen.md` is the one `/gen` (the stopgap's user-level copy is deleted too).
+### Enhance or convert a recorded take
+
+```sh
+pnpm archilyzer voice setup --engine deepfilternet --dry-run # what it fetches, how big; then without --dry-run
+pnpm archilyzer voice setup --engine openvoice
+pnpm archilyzer voice setup --engine seed-vc --check
+pnpm ops voice-enhance --json '{"file":"/abs/take.wav","out":"/abs/take.clean.wav"}' --wait
+pnpm ops voice-convert --json '{"file":"/abs/take.wav","out":"/abs/take.zac.wav","voice":"orpheus:zac"}' --wait
+umtool posts narrate <project> <item> --derive 1 --op enhance
+umtool posts narrate <project> <item> --derive 2 --op convert --voice zac --engine seed-vc
+```
+
+- Two editor ops over a speech recording, each a job on the `voice` queue, one at a time, its engine run behind the
+ heavy slot with the engine's declared estimate (`settings.voice.heavyEstimateMB`): **enhance** (denoise, soften the
+ room, level by one static gain) and **convert** (the timing and pitch contour kept, the timbre swapped for a STOCK
+ synthetic voice). The result is a 48 kHz mono WAV exactly as long as the input; `out` is never inside the corpus.
+ umtool's derived takes are the usual caller: a new take from take n, the original kept, a parted take part by part.
+- **A convert target is a stock voice of our own TTS engines** — `orpheus:zac`, `orpheus:leah`, `kokoro:am_michael`,
+ or a bare name one engine has (`zac`). A file, a path or a recording is refused, whatever it holds: these engines
+ clone from seconds of audio, so no real person's voice is ever a target. Its reference (the voice reading "The North
+ Wind and the Sun") is asked of the `tts` op the first time and kept under `settings.voice.home/targets/`.
+- Engines (`settings.voice`): enhance `deepfilternet` (DeepFilterNet 3, the default) or `rnnoise` (ffmpeg's arnndn,
+ nothing to install); convert `openvoice` (OpenVoice v2's converter, the default) or `seed-vc` (Seed-VC v1, closer
+ to the target, several times slower). All on the CPU. `voice setup` says what it fetches first; `--check` lists
+ what is missing; an engine not installed is refused before a job ("not installed", which umtool shows).
+- While a GPU transcription pins its memory the heavy slot holds a voice job back (`heavy: waiting for memory`): the
+ gate working, not a hang.
+
## Research runs
```sh
diff --git a/common/controller/voiceFile.test.ts b/common/controller/voiceFile.test.ts
@@ -153,7 +153,7 @@ test("the body's shape is judged before the disk", () => {
test("a convert target is a stock voice: a file, a path or a recording is refused", () => {
const v = DEFAULT_VOICE_SETTINGS;
- for (const target of ["/home/someone/voice.wav", "me.wav", "~/rec.flac", "https://example.com/a.mp3", "file:///x.wav", "orpheus/zac", "C:\\voice.wav", "operator"]) {
+ for (const target of ["/home/someone/voice.wav", "me.wav", "~/rec.flac", "https://example.com/a.mp3", "file:///x.wav", "orpheus/zac", "C:\\voice.wav", "operator", "user"]) {
const r = resolveVoiceRequest("convert", { file: "/a.wav", out: "/b.wav", target }, v);
assert.ok(!r.ok, target);
if (!r.ok) assert.match(r.error, /STOCK synthetic voice|not a stock voice|refused/, target);
@@ -328,6 +328,7 @@ test("a convert makes its stock target's reference through the tts op once, then
assert.equal(run[run.indexOf("--target-ref") + 1], ref.wav);
assert.match(run[run.indexOf("--target-se") + 1], /voice-home\/openvoice\/targets\/espeak-ng-en-us\.[0-9a-f]{12}\.se\.pt$/);
assert.equal(r.result.target, "espeak-ng:en-us");
+ assert.equal(r.result.voice, "en-us");
assert.equal(r.result.synthetic, true);
assert.equal(r.result.disclosure, "Narration: voice converted to a synthetic voice (OpenVoice v2 (tone-colour converter) · espeak-ng:en-us)");
assert.ok((await stat(out)).size > 44);
diff --git a/common/controller/voiceFile.ts b/common/controller/voiceFile.ts
@@ -36,7 +36,7 @@
// THE RESULT is logged as ONE line starting with VOICE_RESULT_MARKER (the
// marker umtool's askEditorOp reads): `{op, engine, wav, seconds, samples,
// sampleRate, engineMs, durationMs, waitedMs, gainDb, params, parts?,
-// target?, synthetic, disclosure?}`. `wav` is `out`, 48 kHz mono 16-bit, as
+// target?, voice?, synthetic, disclosure?}`. `wav` is `out`, 48 kHz mono 16-bit, as
// long as the input to the sample.
//
// WHAT IT TOUCHES: reads `file` and each part (anywhere); writes `out`, each
@@ -475,7 +475,10 @@ export type VoiceResult = {
gainDb?: number;
params: Record<string, number | boolean>;
parts?: { wav: string; seconds: number }[];
+ // Convert: the stock target (`orpheus:zac`) and its voice alone (`zac`, the
+ // shape a umtool take records).
target?: string;
+ voice?: string;
synthetic: boolean;
disclosure?: string;
};
@@ -579,7 +582,7 @@ export async function enqueueVoiceFile(op: VoiceOp, body: Record<string, unknown
...(typeof whole.gainDb === "number" ? { gainDb: whole.gainDb } : {}),
params: req.params,
...(parts.length ? { parts } : {}),
- ...(req.target ? { target: req.target.id, disclosure: voiceConvertDisclosure(req.engine, req.target) } : {}),
+ ...(req.target ? { target: req.target.id, voice: req.target.voice, disclosure: voiceConvertDisclosure(req.engine, req.target) } : {}),
synthetic: op === "convert",
};
onLog(`${VOICE_RESULT_MARKER}${JSON.stringify(result)}`);
diff --git a/common/lib/voiceApps.ts b/common/lib/voiceApps.ts
@@ -402,11 +402,22 @@ export const NO_CLONING =
"never a recording or a file: these engines would make anyone's voice from a few seconds of it, so no real person's " +
"voice is ever a target";
-/** A convert target, parsed against the TTS registry; a path or a recording is refused. Pure. */
+/**
+ * A convert target, parsed against the TTS registry; a path or a recording is
+ * refused. `<engine>:<voice>`, or a bare stock voice name that exactly one
+ * engine has (`zac` is orpheus:zac — the shape umtool records a take's voice
+ * in). Pure.
+ */
export function parseStockTarget(raw: unknown): Check<StockTarget> {
if (typeof raw !== "string" || !raw.trim()) return { ok: false, error: `the target must be a string: ${NO_CLONING}` };
const s = raw.trim();
if (RECORDING_LIKE.test(s)) return { ok: false, error: `"${s}" is refused: ${NO_CLONING}` };
+ if (/^[A-Za-z0-9_-]+$/.test(s)) {
+ const owners = ttsEngineIds().filter((id) => getTtsEngine(id)!.voices.includes(s));
+ if (owners.length === 1) return { ok: true, value: { id: `${owners[0]}:${s}`, ttsEngine: owners[0], voice: s } };
+ if (owners.length > 1) return { ok: false, error: `"${s}" is a stock voice of ${owners.join(" and ")} — name one: ${owners.map((o) => `${o}:${s}`).join(" or ")}` };
+ return { ok: false, error: `"${s}" is not a stock voice: ${NO_CLONING}` };
+ }
const m = /^([a-z0-9-]+):([A-Za-z0-9_-]+)$/.exec(s);
if (!m) return { ok: false, error: `"${s}" is not a stock voice: ${NO_CLONING}` };
const engine = getTtsEngine(m[1]);
diff --git a/common/lib/voiceSettings.test.ts b/common/lib/voiceSettings.test.ts
@@ -38,7 +38,13 @@ test("stock targets: our TTS engines' stock voices, nothing else", () => {
const ok = parseStockTarget(" orpheus:leah ");
assert.ok(ok.ok);
if (ok.ok) assert.deepEqual(ok.value, { id: "orpheus:leah", ttsEngine: "orpheus", voice: "leah" });
- for (const bad of ["leah", "orpheus:", ":zac", "piper:amy", "a.wav", "./zac", "/zac", "http://x/zac", 5, null]) {
+ // A bare stock voice one engine has is that engine's (umtool records a take's voice so).
+ const bare = parseStockTarget("zac");
+ assert.ok(bare.ok);
+ if (bare.ok) assert.equal(bare.value.id, "orpheus:zac");
+ const kb = parseStockTarget("am_michael");
+ assert.ok(kb.ok && kb.value.id === "kokoro:am_michael");
+ for (const bad of ["nobody", "orpheus:", ":zac", "piper:amy", "a.wav", "./zac", "/zac", "http://x/zac", 5, null]) {
assert.equal(parseStockTarget(bad).ok, false, String(bad));
}
assert.match(NO_CLONING, /no real person's\s+voice is ever a target/);
diff --git a/scripts/archilyzer-ops.mjs b/scripts/archilyzer-ops.mjs
@@ -1798,7 +1798,7 @@ export function usage() {
" recording is REFUSED as a target (no real person's voice) — and \"engine\"",
" (openvoice | seed-vc, each installed by `archilyzer voice setup --engine <id>`).",
" The target's reference is synthesized once through the tts op and kept. The",
- " result adds target, synthetic: true and the disclosure line.",
+ " result adds target, voice, synthetic: true and the disclosure line.",
"",
'web-search searches the web (DuckDuckGo\'s HTML page) and answers the',
' results: {"query", "n"?: 6 (at most 20)} -> {results: [{title, url,',
diff --git a/umtool/app/api/report/post-narration/route.ts b/umtool/app/api/report/post-narration/route.ts
@@ -84,8 +84,10 @@ export async function GET(request: Request) {
const from = takes[Number(derive)];
if (!from) return Response.json({ state: "failed", error: `no take ${derive}` }, { headers: noStore });
const op = String(q.get("op") ?? "");
- const engine = q.get("engine");
- const voice = q.get("voice");
+ // The editor's defaults, when the ask named none (its `@@voice-result` line).
+ const vr = resultLine<{ engine?: string; voice?: string }>(st.tail, "@@voice-result ") ?? {};
+ const engine = q.get("engine") ?? vr.engine ?? null;
+ const voice = op === "convert" ? (q.get("voice") ?? vr.voice ?? null) : null;
const partsRel = rel.replace(/\.wav$/, ".parts");
const derived = {
file: rel, engine: "derived", voice: voice ?? from.voice ?? "?", seconds: meas.seconds, source: { kind: "take", from: takeIdOf(from) },
@@ -187,7 +189,8 @@ export async function POST(request: Request) {
? t.parts.map((p) => ({ file: abs(String(p.file)), out: abs(`${partsRel}/p${String(p.n).padStart(2, "0")}.wav`) }))
: null;
try {
- const jobId = await startJob(POST_DERIVE_ROUTES[op as keyof typeof POST_DERIVE_ROUTES], { file: abs(t.file), out: abs(rel), ...(engine ? { engine } : {}), ...(voice ? { voice } : {}), ...(parts ? { parts } : {}) });
+ // `voice` is the convert op's stock target; enhance takes none.
+ const jobId = await startJob(POST_DERIVE_ROUTES[op as keyof typeof POST_DERIVE_ROUTES], { file: abs(t.file), out: abs(rel), ...(engine ? { engine } : {}), ...(voice && op === "convert" ? { voice } : {}), ...(parts ? { parts } : {}) });
return Response.json({ ok: true, jobId, file: rel, from, op: op, engine, voice }, { headers: noStore });
} catch (err) {
const status = (err as { status?: number }).status ?? 502;
diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md
@@ -675,7 +675,7 @@ the shape, the mix, recordings, parts, the best part). One writer for a post's n
| **the recording session** — the cut's posts read aloud in order, part by part, each part on disk as soon as it is kept (a reload resumes), the post's recorded take made and picked when its last part is in | `/projects/<p>/narration/record` (the Cut tab's **Record the narration**): the jump list (recorded / placeholder, n of N), the post's card and attachment, the teleprompter in its parts (the placeholder's `parts.json`, else the script split), the mic, the level, count-in; **Space** record / stop, **r** redo the part, **Enter** the next part (the post done: the next post), **n** / **p** posts; **Play it back**, **Play the placeholder** | — | `GET /api/report/post-narration/record?project&id[&n]` · `POST` multipart `{project, id, n, count, text, para, part}` · `POST {op: "discard", id, n}` · `POST {op: "finish", id}` |
| a recorded take — your own read, part by part, kept as `take-<n>.recorded-<label>.wav`, picked | post bench, **record your read**: the mic, the level, **Record** (R) / **Stop** (S) / **Redo part** / **Next part**, **Keep** / **Discard**, **voice** (the label, default `operator`) | — | `POST` multipart `{project, id, label, script?, part[], text[], para[]}` |
| a synthesized take — the editor's tts op, with direction | post bench, **Re-take with direction** (a note, a voice) | `umtool posts narrate <p> <item> --take [--note "…"] [--voice v] [--engine e] [--speed s]` · every missing one: `--all --take` | `op: "take"` → `{jobId, file}` · `GET ?project&id&job&file` keeps it when done |
-| a derived take — a take run through the editor's `enhance` or `convert` (a stock synthetic voice) into a NEW take, the original kept; "not installed" until the editor has the engine | post bench, **run AI on take #n** (the op, an engine, a stock voice) → **Run → a new take**; a derived take's **Re-run**; a recording's **Re-record** with **then re-run the chain** | `umtool posts narrate <p> <item> --derive <n> --op enhance\|convert [--engine e] [--voice v]` | `op: "derive", from, op2, engine?, voice?` → `{jobId, file}` (or `{installed: false}`) · `GET ?project&id&job&file&derive=<from>&op=…` keeps it |
+| a derived take — a take run through the editor's `enhance` or `convert` (a stock synthetic voice: `zac`, `leah`, `orpheus:zac`, never a recording) into a NEW take, the original kept; enhance engines `deepfilternet` · `rnnoise`, convert `openvoice` · `seed-vc` (unnamed: the editor's settings.voice, recorded on the take); "not installed" until `archilyzer voice setup --engine <id>` | post bench, **run AI on take #n** (the op, an engine, a stock voice) → **Run → a new take**; a derived take's **Re-run**; a recording's **Re-record** with **then re-run the chain** | `umtool posts narrate <p> <item> --derive <n> --op enhance\|convert [--engine e] [--voice v]` | `op: "derive", from, op2, engine?, voice?` → `{jobId, file}` (or `{installed: false}`) · `GET ?project&id&job&file&derive=<from>&op=…` keeps it |
| delete a take (soft: its file to the post's `.trash/`) | post bench, the take's **Delete** | `--delete <n>` | `op: "delete", take` (an index) |
| `narration.pick` — the take that plays | post bench, the take's **Pick** | `--pick <n>` (1 = the first, as `--list` shows) | `patch: {pick}` (an index) |
| `narration.approved` — the picked take on this script, approved (a new script or pick takes it away) | post bench, **approved** | `--approve` · `--unapprove` | `patch: {approved: true \| null}` |
diff --git a/umtool/docs/report-video.md b/umtool/docs/report-video.md
@@ -621,8 +621,14 @@ from; a parted take is processed part by part (its parts kept). The ops are the
each a job like tts: `enhance` (denoise, level, de-reverb; `POST /api/ops/voice-enhance`)
and `convert` (voice conversion: the performance kept, the timbre swapped for a STOCK
synthetic voice, never a real person's; `/api/ops/voice-convert`, disclosed as "voice
-converted to a synthetic voice"). The engines are a follow-up lane's: until the editor has
-one, the bench and `posts narrate --derive` say "not installed" and write nothing. The
+converted to a synthetic voice"). The engines are the editor's (`archilyzer voice setup
+--engine <id>`; OPERATING.md, "Enhance or convert a recorded take"): enhance is
+`deepfilternet` (the default) or `rnnoise` (nothing to install); convert is `openvoice` (the
+default) or `seed-vc`, onto a stock voice named as umtool records one (`zac`, `leah`,
+`am_michael`) or in full (`orpheus:zac`) — a file or a recording is refused. With no
+`--engine`/`--voice` the editor's settings.voice decides, and the take records what it ran
+and landed on. Until an engine is installed, the bench and `posts narrate --derive` say
+"not installed" and write nothing. The
bench lists the takes as a tree (each source take, its derived takes under it) with
**Pick**, **Re-run** (the same step from the same source, a new take), **Re-record** (a
recording's: record again; **then re-run the chain** re-applies the steps its derived
diff --git a/umtool/lib/report/postNarration.test.mjs b/umtool/lib/report/postNarration.test.mjs
@@ -272,6 +272,25 @@ test("a DERIVED take: run through the editor's op into a new take, the original
const { postNarrationDisclosure, rootTakeOf } = await import("umtool-report-to-video/post-narration");
assert.equal(rootTakeOf(n.takes, n.takes[1]), n.takes[0]);
assert.equal(postNarrationDisclosure((await manifest(p)).timeline[0]), "Narration: voice converted to a synthetic voice (rvc · stock-a)");
+ // Enhance takes no voice (the editor refuses the key); the engine the editor
+ // chose by default is recorded from its result line.
+ const e1 = await deriveTake(p, (await manifest(p)).timeline[0], {
+ from: 0, op: "enhance", voice: "ignored",
+ ask: async (route, body) => { asked.push({ route, body }); wav(body.out, 1.5); return { jobId: "job-e", result: { op: "enhance", engine: "deepfilternet" } }; },
+ });
+ assert.equal(asked.at(-1).route, "/api/ops/voice-enhance");
+ assert.equal("voice" in asked.at(-1).body, false);
+ assert.equal(e1.take.voice, "operator");
+ assert.deepEqual([e1.take.steps[0].op, e1.take.steps[0].engine, e1.take.steps[0].voice], ["enhance", "deepfilternet", undefined]);
+ // A convert that named no target: the stock voice the editor landed on.
+ const c1 = await deriveTake(p, (await manifest(p)).timeline[0], {
+ from: 0, op: "convert",
+ ask: async (route, body) => { asked.push({ route, body }); wav(body.out, 1.5); return { jobId: "job-c", result: { op: "convert", engine: "openvoice", target: "orpheus:zac", voice: "zac" } }; },
+ });
+ assert.equal("voice" in asked.at(-1).body, false);
+ assert.equal(c1.take.voice, "zac");
+ assert.deepEqual([c1.take.steps[0].engine, c1.take.steps[0].voice], ["openvoice", "zac"]);
+ for (const k of [3, 2]) await deleteTake(p, (await manifest(p)).timeline[0], k);
// An op the editor has no engine for.
const { OpNotInstalled } = await import("umtool-report-to-video/narrate-via-editor");
await assert.rejects(
diff --git a/umtool/lib/report/postNarrationCli.mjs b/umtool/lib/report/postNarrationCli.mjs
@@ -496,19 +496,24 @@ export async function deriveTake(project, e, { from, op, engine = null, voice =
const parts = Array.isArray(t.parts) && t.parts.every((p) => typeof p.file === "string")
? t.parts.map((p) => ({ ...p, file: `${partsRel}/p${String(p.n).padStart(2, "0")}.wav` }))
: null;
+ // `voice` is the convert op's stock target; enhance keeps the take's voice and takes none.
+ const target = op === "convert" ? voice : null;
const body = {
file: abs(t.file), out: abs(rel),
- ...(engine ? { engine } : {}), ...(voice ? { voice } : {}), ...(params ? { params } : {}),
+ ...(engine ? { engine } : {}), ...(target ? { voice: target } : {}), ...(params ? { params } : {}),
...(parts ? { parts: t.parts.map((p, k) => ({ file: abs(p.file), out: abs(parts[k].file) })) } : {}),
};
const askOp = ask ?? (await import("umtool-report-to-video/narrate-via-editor")).askEditorOp;
- const { jobId } = await askOp(POST_DERIVE_ROUTES[op], body, { ...(editor ? { editor } : {}), emit });
+ const { jobId, result: said } = await askOp(POST_DERIVE_ROUTES[op], body, { ...(editor ? { editor } : {}), emit });
if (!(await stat(abs(rel)).catch(() => null))?.isFile()) throw new NarrateError(`the editor's job ${jobId} finished but ${rel} is not there`);
const m = await measureTake(abs(rel));
+ // The editor's defaults, when the ask named none: the engine it ran, the stock voice it landed on.
+ const ran = engine ?? (typeof said?.engine === "string" ? said.engine : null);
+ const landed = op === "convert" ? (target ?? (typeof said?.voice === "string" ? said.voice : null)) : null;
const take = {
- file: rel, engine: "derived", voice: voice ?? t.voice ?? "?", seconds: m.seconds ?? t.seconds,
+ file: rel, engine: "derived", voice: landed ?? t.voice ?? "?", seconds: m.seconds ?? t.seconds,
source: { kind: "take", from: takeIdOf(t) },
- steps: [{ op, ...(engine ? { engine } : {}), ...(voice ? { voice } : {}), ...(params ? { params } : {}), ranAt: new Date().toISOString(), job: jobId }],
+ steps: [{ op, ...(ran ? { engine: ran } : {}), ...(landed ? { voice: landed } : {}), ...(params ? { params } : {}), ranAt: new Date().toISOString(), job: jobId }],
script: t.script ?? e.narration?.script ?? "", at: new Date().toISOString(), jobId,
...(Number.isFinite(m.lufs) ? { lufs: m.lufs } : {}), ...(parts ? { parts } : {}),
};