commit 0c160da148cde9ca93e3900015661c926c949899
parent 0c9570e4809238e9fbc8d0200c039a27adc7c126
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 3 Nov 2026 11:10:28 -0500
umtool: shouted words are said, not spelled -- an ALL-CAPS word that is not an acronym is lowercased and its sentence ends with "!" (MR. reads Mister); acronyms (FBI, IQ, ASMR, BS …) stay spelled (operator: Orpheus spelled them; say them right and yell them)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/umtool/report-to-video/post-narration.mjs b/umtool/report-to-video/post-narration.mjs
@@ -337,6 +337,30 @@ export function postNarrationFilters({ media, voice, out, sch, gainDb = 0, audio
* "&" "and"; the spacing tidied. Nothing is cut: a shorter read is only ever
* the operator's own edit.
*/
+/** Caps a TTS should still spell out (a shouted ordinary word is said, not spelled). */
+export const SPOKEN_ACRONYMS = Object.freeze(new Set([
+ "AI", "ASMR", "ASMRS", "BS", "CEO", "CIA", "DM", "DMS", "DOJ", "FBI", "FTC", "GTA", "ID", "IQ", "IRL", "JK", "KF",
+ "LGBT", "LGBTQ", "NFA", "NPC", "NSA", "OK", "PC", "RPG", "TV", "UK", "US", "USA", "VPN", "VR", "VTUBER", "VTUBERS", "XD",
+]));
+
+/**
+ * SHOUTED WORDS (operator, 3 Nov: Orpheus spelled them; "it should both say them right and yell them"): an ALL-CAPS
+ * word that is not an acronym is lowercased so it is said, and the sentence holding it ends with "!" -- the
+ * shout is carried by punctuation, the words are unchanged. Tags (<sigh>) and acronyms are left alone.
+ */
+export function speakShouts(script) {
+ return String(script ?? "").replace(/\bMR\.\s*/g, "Mister ").replace(/\bMRS\.\s*/g, "Missus ").split(/(?<=[.!?…])(\s+)/).map((sentence) => {
+ let shouted = false;
+ const said = sentence.replace(/(<[^<>]*>)|\b([A-Z][A-Z']+)\b/g, (m, tag, word) => {
+ if (tag) return tag;
+ if (SPOKEN_ACRONYMS.has(word.replace(/'S$/, "S").replace(/'/g, ""))) return word;
+ shouted = true;
+ return word.toLowerCase().replace(/^i(?=')|^i$/, "I");
+ });
+ return shouted ? said.replace(/\.(["')\]]*)\s*$/, "!$1") : said;
+ }).join("");
+}
+
export function speakableText(text) {
const clean = String(text ?? "")
.replace(/^RT @[A-Za-z0-9_]+:\s*/, "")
@@ -367,7 +391,7 @@ export function speakableText(text) {
.trim(),
)
.filter(Boolean);
- return paras.map((p, i) => (i < paras.length - 1 && !/[.!?…,;:—-]["')\]]*$/.test(p) ? `${p}.` : p)).join("\n\n");
+ return speakShouts(paras.map((p, i) => (i < paras.length - 1 && !/[.!?…,;:—-]["')\]]*$/.test(p) ? `${p}.` : p)).join("\n\n"));
}
/**
diff --git a/umtool/report-to-video/post-narration.test.mjs b/umtool/report-to-video/post-narration.test.mjs
@@ -5,7 +5,7 @@ import assert from "node:assert/strict";
import { test } from "node:test";
import {
POST_NARRATION_DEFAULTS, draftScript, dryGainAt, isNarrated, mixPhaseAt, narrationLevelDb, narrationSchedule,
- nextTakeNumber, pickedTake, postNarrationDisclosure, postNarrationFilters, postNarrationKnobs, readSpanSeconds, speakableText, takeFileOf,
+ nextTakeNumber, pickedTake, speakShouts, postNarrationDisclosure, postNarrationFilters, postNarrationKnobs, readSpanSeconds, speakableText, takeFileOf,
validatePostNarration, validatePostNarrationRender, wetGainAt,
} from "./post-narration.mjs";
import { POST_PICTURE_MIN, mediaTimeAt, postItemFiles, postItemPlan, postItemSeconds, postLayout, ruleSeconds, validatePostItem } from "./post-item.mjs";
@@ -176,6 +176,9 @@ test("SCRIPTS ARE THE POST, VERBATIM: cleaned for pronunciation only, never an e
assert.equal(speakableText("@KorriiNami Trust me & you w/ my plan(s) 😂 https://t.co/x\n\nI hate the weak"), "Trust me and you with my plans.\n\nI hate the weak");
// his "this/that" is read "this slash that"; a URL's slashes are gone before it
assert.equal(speakableText("muscle/fitness and sites/forums/orgs https://x.com/a/b"), "muscle slash fitness and sites slash forums slash orgs");
+ // shouted words are said (lowercased) and the sentence ends "!"; acronyms are left spelled
+ assert.equal(speakShouts("MR. OBVIOUS IS RIGHT AGAIN. I carry the FBI. You are NOT unarmed. That is BS."), "Mister obvious is right again! I carry the FBI. You are not unarmed! That is BS.");
+ assert.equal(speakShouts("<sigh> I'M NOT GONNA STOP."), "<sigh> I'm not gonna stop!");
assert.equal(speakableText("one\ntwo\n\nthree"), "one. two.\n\nthree");
const long = Array.from({ length: 150 }, (_, i) => `w${i}`).join(" ") + ". The end.";
const d = draftScript(long);