# Release 34 lane N2 — `r34/voice-match`: who is speaking, per montage clip (as shipped) An aid to the operator's ear for the co-host hazard: a local speaker-similarity score per montage clip, so the clip deck (N1) puts the doubtful ones first. Deterministic for a given model and input; no network; no LLM; nothing rules. Rulings followed: the UI works with no model you talk to (a button on the deck and the Cut tab; every CLI step has it); the verification is still a person listening; records state rulings; synthetic fixtures only; no corpus writes (the real run read the corpus windows from a copy of the project, read-only). ## What 1. **`scripts/speaker-embed.py`** — WAV segments in, L2-normalised TitaNet-small embeddings out (JSON), through the sherpa-onnx `SpeakerEmbeddingExtractor` diarize-sherpa.py already loads; one thread, 6 decimals. 2. **`common/lib/montage/voiceMatch.mjs`** (+ .d.mts): decode a span at 16 kHz mono (ffmpeg, the window's own clock); the voiced-frames gate (energy relative to the span's loud frames: the phrase, not the gap after it); a fallback span when the phrase holds under 1.5 s of speech; one embedding process per run; score = cosine to a robust reference centroid (0..1) and the best reference item; labels likely ≥ 0.42 > unsure ≥ 0.30 > unlikely; the solo- recording heuristic (`soloRecordingWhy`, `pickReferenceRecordings`); `readVoiceMatch` / `writeVoiceMatch` / `voiceMatchSummary`. Test kit: `testing/audio/syntheticVoice.mjs` (two voices TitaNet separates: ~0.98 within, ~0.63 across) and `testing/audio/fakeSpeakerEmbed.mjs` (the script's contract, no python or model). 3. **`umtool voice-match `** (`umtool/lib/report/voiceMatch.mjs`): each clip's phrase ± 1 s found as the montage render finds it (whisper words, then cues), else the cut ± 1 s; the file the render cuts from (sources.mjs); the reference = the clips ruled keep in `montage-rulings.json` (≥ 3, leave-one-out) else solo recordings on disk (`--reference`, `--reference-video`, `--reference-channel`); `--instances` scores a phrase scan's instances not in the manifest; `--dry`, `--json`, `--span`, `--pad`, `--likely/--unlikely`, `--out`. Keys are N1's `clipMomentKey`. report-to-video exports `./montage`. 4. **The UI**: `/api/report/voice-match` (one nice'd lib/jobs.ts job running the CLI; GET summary / job; cancel); `VoiceMatchPanel` — **Score the voices** with a reference picker — on the clip deck's head (`voicePanel`, additive to N1's ClipDeck) and on the Cut tab, whose rows show `voice 0.43 · unsure`. 5. **Docs**: umtool/docs/report-video.md "Who is speaking: the voice match", cli.md row, CHANGELOG bullet, ENVIRONMENT.md (`VOICE_MATCH_PYTHON` / `_SCRIPT` / `_MODEL`), `.diarize/README.md` note, FACTS section, test kit README rows. ## Commits | sha | what | |---|---| | `595130ff` | common: voice match lib, speaker-embed.py, test kit, unit tests | | `a268ea2e` | umtool: `umtool voice-match`, the job route, the panel, the Cut-tab chip | | `8500888c` | umtool: e2e `voice-match.spec.ts` + fixture (`voice-fixture`, fake engine env) | | `4b13d8a4` | docs + ENVIRONMENT.md declarations; scratch beside the project | | `dcbd270b` | the fake embedder's main check without a cwd-derived path (next-build-trace) | | `a0635a20` | merge main (N1): clipMomentKey keys, deck panel, lenient summary | | (this) | plans: record + FACTS; docs mention the deck | ## Gates (all through the shared lock, from the worktree root) - tsc (all packages): clean before each code commit and after the merge. - common: **4606 (main) → 4617 (4615 pass, 0 fail, 2 skipped)**: +11 voiceMatch (one, the real-TitaNet test, skips without `VOICE_MATCH_PYTHON` + `VOICE_MATCH_MODEL`; run with them: 11/11). - test:scripts: **1160 (main after N1) → 1163 (1159 pass, 0 fail, 4 skipped)**: +3 voiceMatch.test.mjs. - umtool `test`: 45/45 (none of mine in its globs). - `archilyzer docs env --check`, `docs files --check`, `docs cli --check`: clean (ENVIRONMENT.md regenerated). - e2e umtool, single specs: `voice-match.spec.ts` 2/2 (18.8 s); `takes.spec.ts` + `projects.spec.ts` 30/30; after the merge `voice-match.spec.ts` (3 tests now, incl. the deck) + `clip-deck.spec.ts` 5/5 (first run: the deck's 2 failed on my summary reading a hand-made file with no `counts`; fixed with `voiceMatchSummary`). ## The real run (a copy of the slow-news project, corpus read-only) Engine the primary's `.diarize` venv + TitaNet; reference: recordings (no rulings file yet) — 8 the-quartering uploads 2017–2026, 48 pieces, 33 kept (all of 3 uploads' first minutes trimmed). 75 of 80 scored (73 clips + 7 instances; 5 instances have no window on disk), 35–38 s, 310 MB. Two runs identical but for `madeAt`. - Distribution: 0–0.1: 3 · 0.2–0.3: 1 · 0.3–0.42: 4 · 0.42–0.5: 1 · 0.5–0.6: 3 · 0.6–0.7: 21 · 0.7–0.8: 36 · 0.8–0.9: 6. Median 0.71. - **The two ruled another speaker: `ynWQxASVthg@3127.54` (old #4, dropped from the manifest, scored from instances.json) 0.241 unlikely; `v70yc82@3597.60` (s56, old #58) 0.005 unlikely.** Solo uploads all likely (0.432 s05 … 0.765). m69i-maW88g@454 (him reading a tweet, ruled out by the operator) 0.527 likely — a voice match cannot tell read-aloud, which is the deck's verdict to make. - Also unlikely: s39 (0.071), s40 (0.000); unsure: s44 0.319, s45 0.392, s46 0.398, s66 0.405 — for the ear. ### Score table | clip | source moment | score | best | label | speech s | span | |---|---|---|---|---|---|---| | s01 | `the-quartering/f8GaZP7tL-8@2.91` | 0.676 | 0.623 | likely | 2.34 | cues | | s02 | `the-quartering/qU1ioyPGsqc@871.82` | 0.662 | 0.650 | likely | 2.58 | cues | | s03 | `the-quartering/O_7BC0kNCGs@659.58` | 0.765 | 0.709 | likely | 2.42 | cues | | s04 | `the-quartering/6-VGIqjM3gI@12.36` | 0.763 | 0.756 | likely | 2.82 | cues | | s05 | `the-quartering/Ov35xvnPgOs@84.10` | 0.432 | 0.454 | likely | 2.46 | cues | | s06 | `the-quartering/QncOdQy3jCw@609.18` | 0.637 | 0.707 | likely | 2.06 | cues | | s07 | `the-quartering/orJMUSV76Po@364.88` | 0.712 | 0.725 | likely | 2.14 | cues | | s08 | `the-quartering/wFBfJahTWUs@27.36` | 0.732 | 0.725 | likely | 2.24 | cues | | s09 | `the-quartering/ko1wAJKPtdg@162.96` | 0.716 | 0.696 | likely | 2.62 | cues | | s10 | `the-quartering/icnzB70f_bE@51.12` | 0.732 | 0.698 | likely | 2.72 | cues | | s11 | `the-quartering/NjtQ8Dyqnwk@4.96` | 0.749 | 0.739 | likely | 2.34 | cues | | s12 | `the-quartering/y5MocPVTv9A@49.36` | 0.715 | 0.719 | likely | 2.66 | cues | | s13 | `the-quartering-rumble/vhyhaz@66.64` | 0.744 | 0.722 | likely | 2.46 | words | | s14 | `the-quartering-rumble/vpdtvn@649.04` | 0.643 | 0.759 | likely | 2.84 | words | | s15 | `the-quartering-rumble/vpdt0v@11.62` | 0.787 | 0.752 | likely | 2.24 | words | | s16 | `cornbreadman/38e650fa36b36b1c344b73f68654ec511da706ae@1606.00` | 0.709 | 0.707 | likely | 1.9 | cues | | s17 | `the-quartering-rumble/v14d52c@3.92` | 0.663 | 0.662 | likely | 2.52 | words | | s18 | `the-quartering-rumble/v1d1qso@1239.06` | 0.723 | 0.729 | likely | 2.2 | words | | s19 | `the-quartering-rumble/v1i1sgy@4664.56` | 0.762 | 0.762 | likely | 2.14 | words | | s20 | `the-quartering-rumble/v28xqot@178.98` | 0.703 | 0.679 | likely | 2.2 | words | | s21 | `the-quartering-rumble/v2bc8kr@4223.52` | 0.682 | 0.645 | likely | 2.42 | words | | s22 | `the-quartering-rumble/v2car0l@526.84` | 0.790 | 0.744 | likely | 2.72 | words | | s23 | `the-quartering-rumble/v2cjwi9@2132.96` | 0.750 | 0.758 | likely | 2.24 | words | | s24 | `the-quartering-rumble/v2cjwi9@2560.16` | 0.662 | 0.693 | likely | 2.84 | words | | s25 | `cornbreadman/695d11f47b1f7286d46ce420a3d742217e7378d9@1305.52` | 0.654 | 0.645 | likely | 2.3 | cues | | s26 | `the-quartering/g8BAomXSTaQ@488.16` | 0.737 | 0.684 | likely | 2.46 | cues | | s27 | `the-quartering/dXhMvZA5ef8@8.28` | 0.668 | 0.685 | likely | 2.38 | cues | | s28 | `cornbreadman/316031cdedff41b62278f3577b3fee9a1de6de5a@3796.08` | 0.724 | 0.717 | likely | 2.86 | cues | | s29 | `the-quartering/JkgzGFb0Ju8@4.56` | 0.745 | 0.736 | likely | 2.54 | cues | | s30 | `cornbreadman/9251b6222d97900140dd5d670e76eeeae888c2b3@2402.32` | 0.638 | 0.650 | likely | 2 | cues | | s31 | `the-quartering/2z0R2352Ysw@334.86` | 0.560 | 0.597 | likely | 2.2 | cues | | s32 | `the-quartering-rumble/v32pn0y@5335.80` | 0.736 | 0.772 | likely | 2.22 | words | | s33 | `the-quartering-rumble/v3lp5dz@2513.90` | 0.710 | 0.673 | likely | 2.2 | words | | s34 | `the-quartering-rumble/v3pwxwa@3810.00` | 0.813 | 0.754 | likely | 3.54 | words | | s35 | `cornbreadman/08f1f447c258b92ad639e865efc7629cfef91073@2989.84` | 0.761 | 0.746 | likely | 2.54 | cues | | s36 | `the-quartering-rumble/v4aaixo@2732.16` | 0.601 | 0.650 | likely | 3.48 | words (fallback) | | s37 | `the-quartering-rumble/v4aqir9@3463.84` | 0.723 | 0.738 | likely | 2.6 | words | | s38 | `the-quartering-rumble/v4dl2pq@6331.00` | 0.756 | 0.749 | likely | 2.8 | words (fallback) | | s39 | `the-quartering-rumble/v4sw6ck@3218.08` | 0.071 | 0.151 | unlikely | 5.26 | cut | | s40 | `the-quartering-rumble/v4wsyvo@5195.52` | 0.000 | 0.000 | unlikely | 2.18 | words | | s41 | `the-quartering-rumble/v518ptn@1175.00` | 0.593 | 0.579 | likely | 2.42 | words | | s42 | `the-quartering-rumble/v5fakjf@554.54` | 0.670 | 0.644 | likely | 2.26 | words | | s43 | `the-quartering-rumble/v5fakjf@2132.16` | 0.667 | 0.646 | likely | 2.58 | words | | s44 | `the-quartering-rumble/v5jl6o5@8651.64` | 0.319 | 0.367 | unsure | 2.36 | words | | s45 | `the-quartering-rumble/v64wgr1@53.46` | 0.392 | 0.435 | unsure | 2.76 | words | | s46 | `the-quartering-rumble/v64wgr1@3516.58` | 0.398 | 0.429 | unsure | 5.48 | words (fallback) | | s47 | `the-quartering-rumble/v69py5m@55.00` | 0.804 | 0.786 | likely | 2.56 | words | | s48 | `the-quartering-rumble/v6r8iru@2329.98` | 0.694 | 0.680 | likely | 2.18 | words | | s49 | `the-quartering-rumble/v6r8iru@5847.82` | 0.686 | 0.658 | likely | 2.16 | words | | s50 | `the-quartering-rumble/v6sqr91@96.48` | 0.769 | 0.691 | likely | 1.66 | words | | s51 | `the-quartering-rumble/v6ss2d5@1091.68` | 0.729 | 0.705 | likely | 2.2 | words | | s52 | `the-quartering-rumble/v6ss2d5@1099.84` | 0.639 | 0.647 | likely | 2.18 | words | | s53 | `the-quartering-rumble/v6yjkwk@3351.24` | 0.668 | 0.672 | likely | 1.76 | words | | s54 | `the-quartering-rumble/v6zrrlq@3297.76` | 0.767 | 0.754 | likely | 2.1 | words | | s55 | `the-quartering-rumble/v70yc82@3528.48` | 0.760 | 0.718 | likely | 2.36 | words | | s56 | `the-quartering-rumble/v70yc82@3597.60` | 0.005 | 0.069 | unlikely | 3.42 | words | | s57 | `the-quartering-rumble/v7857kg@3469.54` | 0.708 | 0.731 | likely | 2.66 | words | | s58 | `the-quartering-rumble/v786x5i@1045.16` | 0.804 | 0.799 | likely | 2.66 | words | | s59 | `the-quartering-rumble/v79j3r8@474.00` | 0.821 | 0.785 | likely | 2 | words | | s60 | `the-quartering/GuRHjN2e1kE@769.48` | 0.602 | 0.635 | likely | 2.28 | cues | | s61 | `the-quartering-rumble/v79jnqy@7134.08` | 0.751 | 0.736 | likely | 1.96 | words | | s62 | `the-quartering-rumble/v79sihy@3833.64` | 0.744 | 0.759 | likely | 2.5 | words | | s63 | `the-quartering-rumble/v7arhpy@7288.00` | 0.708 | 0.699 | likely | 1.64 | cues | | s64 | `the-quartering-rumble/v7arhpy@7304.32` | 0.611 | 0.652 | likely | 1.72 | cues | | s65 | `the-quartering-rumble/v7cofng@455.92` | 0.775 | 0.796 | likely | 2.08 | cues | | s66 | `the-quartering-rumble/v7d5pl6@2260.24` | 0.405 | 0.467 | unsure | 2.64 | cues | | s67 | `the-quartering-rumble/v7dcdd6@2606.64` | 0.806 | 0.795 | likely | 2.38 | cues | | s68 | `the-quartering-rumble/v7fsm4y@351.04` | 0.605 | 0.610 | likely | 1.66 | cues | | s69 | `the-quartering-rumble/v7fucc4@293.20` | 0.731 | 0.721 | likely | 2.56 | cues | | s70 | `the-quartering-rumble/v7fucc4@357.52` | 0.804 | 0.831 | likely | 7.2 | cues (fallback) | | s71 | `the-quartering-rumble/v7fw0t0@2590.72` | 0.618 | 0.657 | likely | 1.46 | cues (fallback) | | s72 | `the-quartering-rumble/v7gh5pq@2728.64` | 0.725 | 0.760 | likely | 2.64 | cues | | s73 | `the-quartering-rumble/v7gh5pq@4851.12` | 0.714 | 0.756 | likely | 2.66 | cues | | — | `the-quartering/ynWQxASVthg@3127.54` | 0.241 | 0.288 | unlikely | 2.18 | cues | | — | `the-quartering/m69i-maW88g@454.26` | 0.527 | 0.617 | likely | 1.82 | cues | | — | `the-quartering-rumble/v2ljh5d@488.72` | | | no local window | 0 | words | | — | `the-quartering-rumble/v2lpc5x@6.72` | | | no local window | 0 | words | | — | `the-quartering-rumble/v2mqmp1@3.96` | | | no local window | 0 | words | | — | `the-quartering-rumble/v2zfc20@335.60` | | | no local window | 0 | words | | — | `the-quartering-rumble/v475edo@2987.00` | | | no local window | 0 | words |