Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 2b1b60819e4b00eb4628f994451082af3a748ecc
parent 2bc9e74a14c667065f3e947ba1e04b250bac9ce8
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Thu,  5 Nov 2026 15:41:51 -0500

Merge fix/pause-at: --pause "@<seconds>=<pause>", a pause pinned to a time of the take

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Meditor/CHANGELOG.md | 1+
Mumtool/docs/cli.md | 2+-
Mumtool/docs/knobs.md | 2+-
Mumtool/lib/report/postPause.mjs | 26++++++++++++++++++++++++--
Mumtool/lib/report/postPause.test.mjs | 16++++++++++++++++
5 files changed, 43 insertions(+), 4 deletions(-)

diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## [Unreleased] +- **`posts reread --pause "@71.2=0.45"`: a pause at a time of the take.** A read whose word timings drift (a script word said as several -- "45" as "forty-five") put a word-named pause inside the next word. `@<seconds>` names the time instead; the cut is the quietest point within 0.15 s of it, kept on later re-cuts. - **umtool: a slur can be masked by its first and last letter, so its form is told apart.** The slur filter's pill showed one mask per slur for every form ("n*****" for the "-a" form as for the "-er" one). `umtool posts slurs <p> edges <word>` (a slur's word, id or any form names it; `--off` takes it back) now masks every form of that slur as its first letter, stars and its last letter, in the case the post wrote it -- "n***a", "n****s", "f****t", "f*****s", "N***A" (`render.posts.slurs.edges`). The one mask per word is what the card's pill, Play, the bench, a chapter line, a caption and `posts slurs ls` show (`ls` says `edges: …`, by mask); the Cut tab's Options → Reads and voices → Slur filter has **Edge mask** and **First letter only** beside a word. A cut without `edges` renders exactly as before; the read's stand-in ("n-word") is unchanged. - **A reply that is only a video with sound now plays its sound, and plays to its end.** A picture-only reply whose attachment is a video with audio (the "It's time to stop" meme from its original upload) used to play silent, cut to 4 s. Now its sound plays through its beat before the reply is read, mixed like any attachment's sound and never ducked under the read. The beat lasts the whole clip, up to 8 s. Play unmutes it on its own clock during the beat. A GIF stays silent, and the same post carried up as context shows a still with no sound. The cut's picture-only rule now has a command: `umtool posts picture-reply <p> [on=] [image=] [min=] [max=] [maxSound=] [--in-take <take>]`. - **A reply that is only a picture keeps its picture when it is carried up as context.** When the next post of a thread answered Kirsche's picture-only reply, her card was carried up above it with only her name and a lone "@ObviousRises" line: the Millennial Woes screenshot it was made of vanished (operator, 5 Nov, mid-16: "keeping the millenial woes tweet persistent like text rather than removing it would be better"). A picture-only post carried in from the item before, or kept on top by the next post of its run, now keeps its picture in its card, shrunk and dimmed with it the way a text post keeps its words. A GIF or a video shows as a still from the middle of its clip, the channel's censor markup still applies, it never moves beside the card, and it gets no second beat. Item lengths are unchanged, and posts that are not picture-only render exactly as before. diff --git a/umtool/docs/cli.md b/umtool/docs/cli.md @@ -92,7 +92,7 @@ Inbox cannot disagree about what is wrong with one. | `posts reread <project> <item> [--without parent:0\|parent:1\|quoted[,…]] [--drop-parts 3,4] [--drop-urls] [--dry-run] [--json]` | a narrated read **re-joined without a piece**, no TTS ([knobs.md](knobs.md#thread-reads-every-part-of-a-read-on-screen-while-it-is-said), [report-video.md](report-video.md#thread-reads)): the picked take's kept parts cut out of its own file (ffmpeg) and joined with the read's pauses, measured, added as a derived take (`steps: [{op: "rejoin", drop}]`, its parts re-timed with their roles, its word timings moved, its slurs state kept) and picked — ONE write (one undo point). `--without` drops the parts that read the post it answers (`parent:0`), its parent (`parent:1`) or the quoted post; `--drop-parts` by number; `--drop-urls` the parts that are nothing but a link. Nothing to drop, every part dropped or a take read in one go: **exit 1**. `posts set-item … thread.parent.<i>=context\|hidden` (or `thread.quoted=…`) on a piece the take reads runs it first (`--no-reread`: refused, as before) | | `posts reread <project> <item> --tempo-for "4-16=1.35,21-25=1.3" \| --tempo <x> --parts <runs> [--stretch atempo\|rubberband] [--dry-run] [--json]` | a narrated read's **parts re-timed**, no TTS ([knobs.md](knobs.md#thread-reads-every-part-of-a-read-on-screen-while-it-is-said), [report-video.md](report-video.md#a-long-read-sped-up-and-its-caps-yelled)): the parts named time-stretched (1–1.6, pitch kept), the rest untouched, joined with the read's pauses (each stretched part padded and trimmed to its length, sample-exact), its words scaled with their part, a derived take (`steps: [{op: "tempo", tempo, params: {stretch}}]`) picked in ONE write. A tempo is absolute: on a re-timed take it re-cuts from the take before. `posts set-item <p> <item> narration.tempo="4-16=1.35"` runs the same. A part outside the take, a tempo outside 1–1.6, nothing changed: **exit 1** | | `posts reread <project> <item> --yell-caps [--yell-gain 5.5] [--yell-style raise\|shout\|loud] [--dry-run] [--json]` · `posts yell <project> --all \| <item …> [--yell-gain …] [--yell-style …] [--dry-run] [--json]` | a narrated read's **caps yelled**, no TTS ([report-video.md](report-video.md#a-long-read-sped-up-and-its-caps-yelled), `lib/report/postYell.mjs`): his ALL-CAPS words found in the take's word timings and raised (the lift measured, its loudness within 1 LU), acronyms and masked slurs left flat, a derived take (`steps: [{op: "yell", spans, params}]`) picked (one undo point per item). No word timings: **exit 1** naming `posts narrate --words`; `posts yell --dry-run` lists every item's caps, the flat ones and why, and which need word timings | -| `posts reread <project> <item> --pause "<word>[#<n>]=<seconds>[,…]" [--target post\|parent:0\|quoted\|linked:0] [--dry-run] [--json]` | **pauses put in after words** of a narrated read, no TTS (`lib/report/postPause.mjs`; operator, 5 Nov: a countdown "20 10 4 0" read without a breath): the picked take cut just after each word named (half way into the quiet before the next word, at most 0.1 s past its end) and that much silence (0.05–3 s) put in -- each cut moved to the quietest 10 ms its word allows (40 ms before its timed end up to the next word, ±40 ms when they run together) when that is clearly quieter (~3 dB) than the timing's own, and each side of the silence faded over 10 ms, so a pause in normally paced speech does not click -- everything after moved on -- its words (by index), its parts (one a pause falls in grows), its length -- so word zooms, captions, slams, beeps and the read-follow stay on their words; an effect with a set `at` does not move (the plan counts them). A word is matched as a word zoom's is (case and edge punctuation aside; a phrase pauses after its last word; `#n` its n-th time in the read; `--target` counts only the words of the parts reading that piece). A derived take (`steps: [{op: "pause", pauses: [{word, w, at, seconds}]}]`) picked in ONE write. **Absolute**, like a tempo: on a take whose last step is a pause it re-cuts from the take before (the pauses it had kept, a word named again takes the new seconds, `=0` takes one away). `--in-take <t>` puts it in a take's read. No word timings (**exit 1**, naming `posts narrate <p> <item> --words`), a word not read, an occurrence not there, nothing to change: **exit 1**; a malformed spec, seconds outside 0.05–3, `--pause` with another reread form: **exit 2** | +| `posts reread <project> <item> --pause "<word>[#<n>]=<seconds>\|@<take s>=<seconds>[,…]" [--target post\|parent:0\|quoted\|linked:0] [--dry-run] [--json]` | **pauses put in after words** of a narrated read, no TTS (`lib/report/postPause.mjs`; operator, 5 Nov: a countdown "20 10 4 0" read without a breath): the picked take cut just after each word named (half way into the quiet before the next word, at most 0.1 s past its end) and that much silence (0.05–3 s) put in -- each cut moved to the quietest 10 ms its word allows (40 ms before its timed end up to the next word, ±40 ms when they run together) when that is clearly quieter (~3 dB) than the timing's own, and each side of the silence faded over 10 ms, so a pause in normally paced speech does not click -- everything after moved on -- its words (by index), its parts (one a pause falls in grows), its length -- so word zooms, captions, slams, beeps and the read-follow stay on their words; an effect with a set `at` does not move (the plan counts them). A word is matched as a word zoom's is (case and edge punctuation aside; a phrase pauses after its last word; `#n` its n-th time in the read; `--target` counts only the words of the parts reading that piece). A derived take (`steps: [{op: "pause", pauses: [{word, w, at, seconds}]}]`) picked in ONE write. **Absolute**, like a tempo: on a take whose last step is a pause it re-cuts from the take before (the pauses it had kept, a word named again takes the new seconds, `=0` takes one away). `--in-take <t>` puts it in a take's read. No word timings (**exit 1**, naming `posts narrate <p> <item> --words`), a word not read, an occurrence not there, nothing to change: **exit 1**; a malformed spec, seconds outside 0.05–3, `--pause` with another reread form: **exit 2** | | `posts reread <project> <item> --revoice "<phrase>[#<n>]" --say "<what to say instead>" [--target <piece>] [--voice <v>\|auto] [--xfade 0.03] [--splice <from>-<to>] [--dry-run] [--json]` | **one phrase of an approved read re-voiced**, the rest untouched (`lib/report/postRevoice.mjs`; operator, 5 Nov: the countdown gabbled, and pauses cut into it "choppy"): the phrase found in the picked take's word timings as `--pause` finds a word (`#n`, `--target`; inside one part), the original cut from just before its first word to just after its last -- each cut at the quietest 10 ms within ±40 ms of the boundary, and when that is still speech within ±0.15 s (never inside the phrase as timed; a nearer quiet preferred) -- **`--say` alone synthesized by the editor's TTS** (narrate-via-editor; the engine of the root take, the voice of the part the phrase is in, `--voice` overrides; the project's lexicon, redaction and slur filter applied; kept in `narration/parts-cache/` like a thread read's parts, so asking again is free), its lead and tail of silence trimmed, loudness-matched to the speech in the 2 s either side (±6 dB) and spliced in with equal-power crossfades (`--xfade`, 0–0.2 s) at both joins, at the take's rate and layout. The length is exact: the take − the span cut + the piece. Everything after moves by the difference (its words, the part holding the span, the later parts) so zooms, captions, slams, beeps and the read-follow stay on their words; the new words are timed from the piece's speech and marked `estimated` (a later `posts narrate … --words` refines them); the part's text and the script say `--say`. A derived take (`steps: [{op: "revoice", revoice: {word, count, words, phrase, say, said, voice, engine, from, to, seconds, gain, xfade, key}}]`) picked in ONE write; re-voicing exactly the words a re-voice put in re-cuts from the take before. `--dry-run`: the span (words, seconds), each cut and its level, what is said and in which voice, the length change when the piece is cached -- no TTS. A cut still in speech is warned of (the word timings off there): `--splice 65.03-66.00` sets the cuts (either side may be left out). `--in-take <t>` puts it in a take's read. No word timings (naming `posts narrate <p> <item> --words`), the phrase not read or across two parts, a recorded read, the TTS failing: **exit 1**; no `--say`, a bad voice, crossfade or splice, `--revoice` with another reread form: **exit 2** | | `posts progress <project> [auto\|on\|off\|default] [--json]` | the cut's **progress bar** default (`render.posts.progress`, `updatePostProgressRender`; [report-video.md](report-video.md#the-progress-bar)); bare, which items draw it | | `timeline <project> threads [--json]` · `timeline <project> threads --write [--conversation <id>]` | **the cut's conversations** ([report-video.md](report-video.md#thread-reads), `post-conversation.mjs`): each tree of two post items or more — its root, its items' places, whether they play as one run (one scene) or are split by other entries, a reply placed before the post it answers, an item re-reading a post its run already read (with `posts set-item <p> <item> thread.parent.<i>=context`). `--write` gathers each (or the one holding `<id>`: its root, a post, an item, a `thread.group` name) at its first item's place in TREE order (a manual thread: in DATE order) — a post after what it answers, sibling branches by date, each depth first — in ONE write (one undo point); never across a section boundary (gathered within each section, and said) | diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md @@ -961,7 +961,7 @@ gathers them). | a read RE-JOINED without a piece (no TTS) — the picked take's kept parts cut from its own file and joined with the read's pauses: a derived take (`steps: [{op: "rejoin", drop}]`), picked | post bench, **thread read**: **Read without it** on a context piece the take reads; the post bench's Options → **Re-join the read (no TTS)**: **leave out parts**, **drop the URLs**, **Re-join** | `umtool posts reread <p> <item> --without parent:0` (`parent:1`, `quoted`) · `--drop-parts 3,4` · `--drop-urls` · `--dry-run`; `umtool posts set-item <p> <item> thread.parent.0=context` re-joins first when the take reads it (the knob alone when it does not; `--no-reread`: refused) | `POST /api/report/post-narration {project, op: "reread", id, without: ["parent:0"], dropParts?, dropUrls?}` | | a read's PARTS RE-TIMED (no TTS) — the parts named read at a tempo of 1–1.6 (pitch kept: ffmpeg `atempo`, or `rubberband`), the rest untouched, joined with the read's pauses; the words scaled with their part (read-follow, zooms, captions, slams, beeps keep their place); a derived take (`steps: [{op: "tempo", tempo: {"4-16": 1.35}, params: {stretch}}]`, each part's `tempo` stored), picked. A tempo is ABSOLUTE: on a re-timed take it re-cuts from the take before (each part stretched once) | the post bench's Options → **Re-join the read (no TTS)**: **re-time** `4-16=1.35`, **Re-time** | `umtool posts reread <p> <item> --tempo-for "4-16=1.35,21-25=1.3"` · `--tempo 1.3 --parts 4-16,21-25` · `--stretch rubberband` · `--dry-run`; `umtool posts set-item <p> <item> narration.tempo="4-16=1.35"` (the same) | `POST /api/report/post-narration {project, op: "reread", id, tempo: "4-16=1.35", stretch?}` | | a read's CAPS YELLED (no TTS) — the words he wrote in ALL CAPS (his post, or the piece a part reads) found in the take's word timings and raised: +5.5 dB measured over the spans, a presence lift, compressed, gently saturated, limited, 50 ms ramps; acronyms (`YELL_ACRONYMS`, any caps word with no vowel) and masked slurs left flat; timings kept; loudness within 1 LU of its source; a derived take (`steps: [{op: "yell", spans, params: {gain, style}}]`), picked. Needs the take's word timings (`posts narrate --words`) | the post bench's Options → **Re-join the read (no TTS)**: **Raise the CAPS** | `umtool posts reread <p> <item> --yell-caps [--yell-gain 5.5] [--yell-style raise\|shout\|loud] [--dry-run]` · the cut's: `umtool posts yell <p> --all \| <item …> [--dry-run]` (the dry run lists each item's caps, the ones left flat and why, and the items with no word timings) | `POST /api/report/post-narration {project, op: "reread", id, yell: true, yellGain?, yellStyle?}` | -| PAUSES in a read (no TTS) — the picked take cut just after each word named (half way into the quiet before the next, at most 0.1 s past its end; then moved to the quietest 10 ms the word allows when that is clearly quieter) and 0.05–3 s of silence put in, faded 10 ms either side; everything after moved on: its words, its parts (one a pause falls in grows), its length -- word zooms, captions, slams, beeps and the read-follow keep their words (an effect with a set `at` does not move); a derived take (`steps: [{op: "pause", pauses: [{word, w, at, seconds}]}]`), picked. Words matched as a word zoom's (case and edge punctuation aside, `#n` its n-th time, a phrase after its last word). ABSOLUTE: on a paused take it re-cuts from the take before (`=0` takes one away). Needs the take's word timings (`posts narrate --words`) | the post bench's Options → **Re-join the read (no TTS)**: **pause after** `20=0.45,10=0.45` (and **in** a piece, optional), **Preview** (the dry run: each cut, the new length), **Apply**; on the take-only bench (`?inTake=<t>`) too | `umtool posts reread <p> <item> --pause "20=0.45,10=0.45,4#2=0.6" [--target linked:0] [--dry-run] [--json] [--in-take <t>]` | `POST /api/report/post-narration {project, op: "reread", id, pause: "20=0.45", target?, dryRun?, inTake?}` | +| PAUSES in a read (no TTS) — the picked take cut just after each word named (half way into the quiet before the next, at most 0.1 s past its end; then moved to the quietest 10 ms the word allows when that is clearly quieter) and 0.05–3 s of silence put in, faded 10 ms either side; everything after moved on: its words, its parts (one a pause falls in grows), its length -- word zooms, captions, slams, beeps and the read-follow keep their words (an effect with a set `at` does not move); a derived take (`steps: [{op: "pause", pauses: [{word, w, at, seconds}]}]`), picked. Words matched as a word zoom's (case and edge punctuation aside, `#n` its n-th time, a phrase after its last word). ABSOLUTE: on a paused take it re-cuts from the take before (`=0` takes one away). Needs the take's word timings (`posts narrate --words`) | the post bench's Options → **Re-join the read (no TTS)**: **pause after** `20=0.45,10=0.45` (and **in** a piece, optional), **Preview** (the dry run: each cut, the new length), **Apply**; on the take-only bench (`?inTake=<t>`) too | `umtool posts reread <p> <item> --pause "20=0.45,10=0.45,4#2=0.6" · `@71.2=0.45` (a pause at a time of the take, cut at the quiet within 0.15 s of it: for a read whose word timings drift) [--target linked:0] [--dry-run] [--json] [--in-take <t>]` | `POST /api/report/post-narration {project, op: "reread", id, pause: "20=0.45", target?, dryRun?, inTake?}` | | ONE PHRASE RE-VOICED (TTS for that phrase only) — the phrase found in the picked take's word timings (as a pause finds a word; `#n`; `--target`), cut out at the quietest 10 ms within ±40 ms of each boundary (±0.15 s when that is still speech, never inside the phrase; a cut still in speech is warned of, `--splice <from>-<to>` sets them), `--say` synthesized by the editor in the voice the part was read in (`--voice` overrides; the lexicon applied; cached in `narration/parts-cache/`), loudness-matched to the 2 s about it (±6 dB), spliced in with equal-power crossfades (`--xfade`, default 0.03 s); its words (`estimated`), parts and length moved by the change, so everything timed on the words stays on them; a derived take (`steps: [{op: "revoice", revoice: {word, count, words, phrase, say, said, voice, engine, from, to, seconds, gain, xfade, key}}]`), picked. Re-voicing the words a re-voice put in re-cuts from the take before. Needs the take's word timings | the post bench's Options → **Re-join the read (no TTS)**: **re-voice a phrase (TTS for the phrase only)** `20 10 4 0`, **say** `20... 10... 4... 0...` (and **in** a piece, optional), **Preview** (the dry run: span, cuts, voice; no TTS), **Apply**; on the take-only bench (`?inTake=<t>`) too | `umtool posts reread <p> <item> --revoice "20 10 4 0" --say "20... 10... 4... 0..." [--target linked:0] [--voice <v>\|auto] [--xfade 0.03] [--splice <from>-<to>] [--dry-run] [--json] [--in-take <t>]` | `POST /api/report/post-narration {project, op: "reread", id, revoice: "20 10 4 0", say: "…", target?, voice?, xfade?, splice?, dryRun?, inTake?}` | | the cut's conversations — one run is one scene; `threads --write` gathers each in tree order (a post after what it answers, sibling branches by date, never across a section) | the Cut tab's Options → **Reads and voices** → **Queue: gather conversations** (`--write`, a queue step) | `umtool timeline <p> threads [--json]` · `threads --write [--conversation <id>]` (one undo point) | — (`orderEntries`) | | a post item's `conversation` (the archive row's threadId) and `quoted.via: "link"` (a status link resolved to an archived post) | — | `umtool posts context <p> [--dry-run]` | — (`setPostItemsContext`) | diff --git a/umtool/lib/report/postPause.mjs b/umtool/lib/report/postPause.mjs @@ -60,6 +60,8 @@ export const PAUSE_CUT_INTO_GAP = 0.1; export const PAUSE_CUT_BACK = 0.04; /** The fade at each side of the silence put in, seconds. */ export const PAUSE_FADE = 0.01; +/** How far either side of an @time pause the quietest cut is looked for, seconds. */ +export const PAUSE_PIN_WINDOW = 0.15; const ROLE_RE = /^(post|quoted|parent:\d|media:\d|linked:\d)$/; /** A pause the plan cannot make (no word timings, the word not read, nothing to change): exit 1, not a usage error. */ @@ -89,6 +91,15 @@ export function parsePauseSpec(spec) { if (eq < 0) throw new RereadError(`--pause ${item}: <word>[#<n>]=<seconds>, e.g. 20=0.45 or 4#2=0.45`); const left = item.slice(0, eq).trim(); const right = item.slice(eq + 1).trim(); + // "@71.2=0.45": a pause at a TIME of the take, cut at the quiet nearest it -- for a read whose word timings drift + // (a script word said as several, "45" as "forty-five"), where the word's timed end is not where the gap is. + if (left.startsWith("@")) { + const t = /^\d*\.?\d+$/.test(left.slice(1).trim()) ? Number(left.slice(1).trim()) : NaN; + if (!(fin(t) && t > 0)) throw new RereadError(`--pause ${item}: @<seconds of the take>=<pause>, e.g. @71.2=0.45`); + const sec = /^\d*\.?\d+$/.test(right) ? Number(right) : NaN; + if (!(sec === 0 || (fin(sec) && sec >= lo && sec <= hi))) throw new RereadError(`--pause ${item}: a pause is ${lo}–${hi} seconds (0 takes one away)`); + return { at: t, seconds: sec }; + } const m = /^(.*?)(?:\s*#\s*(\d+))?$/.exec(left); const match = (m?.[1] ?? "").trim(); if (!match || !match.split(/\s+/).some((w) => normWord(w))) throw new RereadError(`--pause ${item}: name a word (or a phrase) the take reads`); @@ -189,7 +200,18 @@ export function pausePlan(entry, { pauses, target = null, cuts = null }) { const had = new Map(recut ? (Array.isArray(up.step.pauses) ? up.step.pauses : []).filter((p) => Number.isInteger(p?.word) && fin(p?.seconds) && p.word < words.length).map((p) => [p.word, p.seconds]) : []); const among = targetWords(entry, take, target); const named = new Map(); + /** @type {Map<number, number>} word index -> a pinned cut (an @time pause, or one kept from the take it re-cuts) */ + const pinned = new Map(recut ? (Array.isArray(up.step.pauses) ? up.step.pauses : []).filter((p) => p?.pinned && Number.isInteger(p?.word) && fin(p?.at)).map((p) => [p.word, p.at]) : []); for (const p of pauses) { + if (fin(p.at)) { + const pool = (among ?? words.map((_, k) => k)).filter((k) => fin(words[k]?.start) && words[k].start <= p.at); + if (!pool.length) throw new RereadError(`--pause @${p.at}: no word of the read starts before it`); + const i = pool[pool.length - 1]; + if (named.has(i) && named.get(i) !== p.seconds) throw new RereadError(`--pause: "${words[i].w}" (word ${i + 1}) is named twice`); + named.set(i, p.seconds); + pinned.set(i, r3(p.at)); + continue; + } const i = findPauseWord(entry, words, among, p, target); if (named.has(i) && named.get(i) !== p.seconds) throw new RereadError(`--pause: "${words[i].w}" (word ${i + 1}) is named twice`); named.set(i, p.seconds); @@ -205,7 +227,7 @@ export function pausePlan(entry, { pauses, target = null, cuts = null }) { if (after.size > PAUSE_MAX) throw new RereadError(`--pause: at most ${PAUSE_MAX} pauses in one take`); const end = fin(take.seconds) ? take.seconds : Infinity; // `cuts` (pauseTake's, from the audio): a word's cut moved to the quiet near it. - const list = [...after].sort((a, b) => a[0] - b[0]).map(([i, s]) => ({ word: i, w: words[i].w, at: fin(cuts?.get?.(i)) ? r3(cuts.get(i)) : cutAfter(words, i, end), seconds: r3(s) })); + const list = [...after].sort((a, b) => a[0] - b[0]).map(([i, s]) => ({ word: i, w: words[i].w, at: fin(cuts?.get?.(i)) ? r3(cuts.get(i)) : pinned.has(i) ? pinned.get(i) : cutAfter(words, i, end), seconds: r3(s), ...(pinned.has(i) ? { pinned: true } : {}) })); // The source cut at each pause, the silence before the span after it. const spans = list.map((p, j) => ({ from: j === 0 ? 0 : list[j - 1].at, to: p.at, gap: j === 0 ? 0 : list[j - 1].seconds })); spans.push({ from: list[list.length - 1].at, to: null, gap: list[list.length - 1].seconds }); @@ -300,7 +322,7 @@ async function quietCuts(project, plan) { const out = new Map(); let last = -Infinity; plan.pauses.forEach((p, j) => { - const { lo, hi } = cutWindow(words, p.word, end); + const { lo, hi } = p.pinned ? { lo: Math.max(0, p.at - PAUSE_PIN_WINDOW), hi: Math.min(end, p.at + PAUSE_PIN_WINDOW) } : cutWindow(words, p.word, end); const q = quietestCut(mono, rate, { lo, hi, nominal: p.at }); // The cuts stay in order (two pauses on words run together never cross). const next = plan.pauses[j + 1]?.at ?? Infinity; diff --git a/umtool/lib/report/postPause.test.mjs b/umtool/lib/report/postPause.test.mjs @@ -179,3 +179,19 @@ test("THE CLI: posts reread --pause --dry-run writes nothing, --json the plan; a assert.equal((await cli(["reread", "cli", "p-1", "--pause", "20=9"])).code, 2); assert.equal((await cli(["reread", "cli", "p-1", "--pause", "20=0.4", "--drop-urls"])).code, 2, "a pause goes alone"); }); + +test("--pause @<seconds>: a pause at a time of the take -- the last word starting before it, its cut pinned there (a read whose word timings drift)", () => { + assert.deepEqual(parsePauseSpec("@71.2=0.45, 20=0.4"), [{ at: 71.2, seconds: 0.45 }, { match: "20", occurrence: 1, seconds: 0.4 }]); + assert.throws(() => parsePauseSpec("@x=0.4"), RereadError); + assert.throws(() => parsePauseSpec("@71.2=9"), RereadError); + const words = [{ w: "45", start: 0, end: 0.5 }, { w: "seconds!", start: 0.5, end: 0.9 }, { w: "just", start: 2.0, end: 2.2 }, { w: "past", start: 2.2, end: 2.5 }]; + const entry = { id: "p-1", type: "post", narration: { pick: 0, script: "45 seconds! just past", takes: [{ file: "narration/posts/1/take-1.x.wav", engine: "x", voice: "v", seconds: 3, words, parts: [{ n: 1, start: 0, seconds: 3, text: "45 seconds! just past" }] }] } }; + const plan = pausePlan(entry, { pauses: parsePauseSpec("@1.6=0.5") }); + assert.equal(plan.pauses.length, 1); + assert.equal(plan.pauses[0].word, 1); // "seconds!" is the last word starting before 1.6 + assert.equal(plan.pauses[0].at, 1.6); // the cut is the time given, not the word's timed end (0.9) + assert.equal(plan.pauses[0].pinned, true); + assert.equal(plan.seconds, 3.5); + assert.equal(plan.words[2].start, 2.5); // later words move by the pause + assert.throws(() => pausePlan(entry, { pauses: parsePauseSpec("@0=0.5") }), RereadError); +});