commit 3c6cde68c815c116269799dc472a332c3918d64c
parent 979fa554fd5ea476ddc0513acf3f43d17521142d
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Sun, 11 Oct 2026 00:22:43 -0400
plans: release 25 — local text-to-speech (Kokoro, af_heart): the tts job and ops, report-video narration, podcast export
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
1 file changed, 56 insertions(+), 0 deletions(-)
diff --git a/plans/release-25.md b/plans/release-25.md
@@ -0,0 +1,56 @@
+# Release 25 — local text-to-speech: narration for report videos, and podcasts
+
+Drafted 2026-10-10 (evening) on the operator's ask ("good local AI text to speech for videos or podcasts made from
+Archilyzer"). Rulings: **bake-off first, then build; stock voices only** — no voice cloning of anyone, no reference-audio
+prompting with a real person's voice; every output discloses a synthetic voice. **Engine + voice (ruled 2026-10-11, by ear from the
+bake-off `~/reports/tts-bakeoff/index.html`): Kokoro-82M only, default voice `af_heart`.** Integration map: the Explore report (job tmp
+`tts-map`), summarized in "Where it plugs in".
+
+## The bake-off, in one paragraph
+
+31 engine/voice runs over four lines (a card, numbers, a quote, a 45-s podcast paragraph), stock voices only. Kokoro-82M
+(kokoro-onnx 0.6.1 on onnxruntime CPU, fp32 `kokoro-v1.0.onnx` + `voices-v1.0.bin`, Apache-2.0 weights; phonemizer
+espeak-ng): RTF 0.46 on 8 CPU threads, load 1.3 s, ≈ 1 GB RAM, UTMOS 4.41 (af_heart 4.52, the best of all 31).
+Piper's better voices are not licensed for publishing; Kitten mini weaker on numbers; Chatterbox RTF 7.5 on CPU (6.5 GB,
+watermarked); Orpheus 3B RTF 1.7 on Vulkan (GPU contention) — not adopted. Kokoro's known wart: it reads "2024" as "two
+thousand twenty-four" (a text pre-pass fixes it); it speaks briskly (speed is a setting).
+
+## Shape
+
+- **Like transcription, never by hand** (the "no ASR by hand" rule's twin): synthesis runs as an editor job,
+ `pnpm ops tts`, through an engine registry. umtool asks the editor for it (as `fetch-via-editor` does).
+- **Its own serial queue, not the transcription worker pool.** The pool's workers are ASR apps (`sanitizeWorkers` forces
+ a local worker's `appId` to a transcription app; an untagged worker takes any lease). A CPU engine on queue `tts`
+ (one synthesis at a time) needs none of that. If the picked engine uses the GPU, the queue's lane `contendsFor: "gpu"`.
+- **Content-addressed cache**: sha256 of (engine, model version, voice, speed, normalized text) → `<ttsDir>/<sha>.wav`
+ (48 kHz mono PCM) + `<sha>.json` sidecar (engine, voice, model, license, seconds, createdAt). Never in `transcripts/`;
+ default `settings.tts.dir` under the checkout's gitignored data dir (implementer picks, documented). A re-ask is free.
+- **Disclosure** is data: the sidecar names the engine and voice; a narrated video's description export and a podcast's
+ show notes carry "Narration: synthetic voice (<engine> · <voice>)".
+
+## Slices
+
+| # | slice | owns | gate |
+|---|---|---|---|
+| **T1** | Engine + job + ops: **`archilyzer tts setup`** (creates a venv at `settings.tts.home` — default `~/.local/share/archilyzer/tts/kokoro` — installs `kokoro-onnx==0.6.1`, and downloads `kokoro-v1.0.onnx` + `voices-v1.0.bin` once from the kokoro-onnx project's `model-files-v1.0` release, verified by size/sha, polite: one stream, no retries in a loop; `--check` reports what is missing), a Python helper `scripts/tts_kokoro.py` (text file in, WAV out; lang from the voice prefix: `b*` → en-gb, else en-us), a **text pre-pass** in common (years 1900–2099 read as spoken — "twenty twenty-four", "nineteen ninety-nine", "two thousand five"; keep numbers otherwise to the engine; unit-tested), `common/lib/ttsApps.ts` (registry: id, label, license, `build({textFile, outWav, voice, speed}) → argv/env`, `voices()`), `scripts/tts.mjs` (dual-use wrapper: text in, WAV out; engine kinds: `kokoro` (default) and `espeak-ng` (the zero-install fallback the tests use)), `settings.tts` (`engine` = kokoro, `voice` = af_heart, `speed` = 1.0, `home` (the venv + models), `dir` (the cache); SETTINGS.md), `paths`/envVars rows (ENVIRONMENT.md), `common/controller/ttsFile.ts` (`enqueueTtsFile`: body `{text | file, voice?, engine?, speed?, out?}`, the corpus fence from transcribeFile, cache hit = a `done` job with `cached: true` and no engine run, result marker `@@tts-result ` `{wav, seconds, engine, voice, cached, durationMs, waitedMs}`), job kind `tts-file` on queue `tts` (not ingest), `editor/app/api/ops/tts/route.ts` + test, `pnpm ops tts` + usage + marker (COMMANDS.md), doctor check (engine + voice present) | common, scripts, editor | unit: registry, body refusals, fence, cache hit/miss, marker; route test; ops test; one real synthesis through the job with espeak-ng; `docs env|files|cli --check`, `settings example --check` |
+| **T2** | Report-video narration: manifest `narration` on `card` entries (`{text, voice?}`; text explicit — never derived from the card: opt-in, the operator's "show, don't tell" stays the default), `render.narration` (`engine?`, `voice?`, `lufs` default −17.7 to sit with the clips (README "teaser level"), `lead`/`tail` ≥ the crossfade `D`), `validateNarration` in `build-video.mjs` AND `lint.mjs` (text non-empty, length cap), `narrate-via-editor.mjs` (one batch of `pnpm ops tts` asks, follows the jobs, NDJSON events; driver step + `busy.mjs` regex), `buildCardSegment` swaps `anullsrc` for the narration WAV (`apad`/`atrim`, leveled, at `render.audioRate`/`audioChannels`), card `seconds`: `"auto"` = narration + lead + tail, a number shorter than that is a lint ERROR; a narration record beside the segment (teaser-style) so rebuilds re-encode only on change; chapters/description export add the disclosure line | umtool/report-to-video, umtool/lib/report | unit: validator, seconds auto, record invalidation, the ffmpeg args; one fixture build with a narrated card through a fake editor (e2e fixture); `onscreen*.spec` untouched or updated |
+| **T3** | Podcast: `build-video.mjs <manifest> --audio-only` (or `build-podcast.mjs`) renders the same entry list as sound only — clips' audio, narrated cards, a short silence for an unnarrated card (or skip it: `render.podcast.skipSilentCards`, default true) — loudness-normalized (−16 LUFS, podcast norm), chapters from the same ffmeta, to `out/<variant>/podcast.m4a` (+ `podcast.mp3`), and `show-notes.md` (chapters with timestamps, every cited source's link, the disclosure). umtool's report page offers it beside the video export | umtool | unit on the entry→audio plan and notes; one fixture render; the umtool spec for the export button |
+| **T4** (later) | Publishing a podcast: `reports attach-audio` + an RSS enclosure on the report feed; docker image TTS stage + `fetch_tts_voice()` | common/publish, export, docker | — deferred, not this release |
+
+**Order / lanes:** T1 ∥ T2 (T2 codes against T1's contract above and a fake editor in its tests), then T3 after T2.
+Two Opus implementers. Gates as release 23/24 (tsc per commit; the four builds; `pnpm e2e:all`; privacy counts).
+
+## Where it plugs in (from the map)
+
+`transcribeFile.ts` (body/fence/marker/`runManagedFunction`, `:65–608`) is the template for `ttsFile.ts`;
+`transcriptionApps.ts` for `ttsApps.ts`; `scripts/diarize.mjs` for `scripts/tts.mjs`; `jobKinds.ts` `transcribe-file`
+(`:898–911`) for `tts-file`; ops `transcribe` (`archilyzer-ops.mjs:331,354,577`) and its route/test for `tts`;
+`settingsSchema.ts` diarization block (`:263–277`, `:1812`) + `settingsDocs.ts` for `settings.tts`; report-to-video
+`buildCardSegment` (`build-video.mjs:1398–1430`) — the `anullsrc` input is where narration goes; validators at
+`:4002–4022` and `lint.mjs:193–203`; `fetch-via-editor.mjs` + `driver.mjs:230–260` + `busy.mjs:29` for
+`narrate-via-editor`; `muxChapters` (`:3838–3871`) and `export.mjs` for the podcast's chapters and notes.
+
+## Not doing
+
+Voice cloning (ruled out); narration derived automatically from card text; narration under clips (the join graph —
+bigger, later if wanted); a cloud TTS.