Archilyzer · Source

archilyzer

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

commit a14fb8510532c1f291cc45cdaff8667c87fbfb26
parent 7b07fad716135f287e7fe27e8f93aaef8b2f070d
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Fri, 13 Nov 2026 23:49:05 -0500

Clip kit LOW fixes: soften, smooth zooms, the writer's cut check, cold-open gaps, fonts by name

- render.zooms.maxScale is renamed render.zooms.soften and its rule written down: a zoom
  may play its source at up to soften x max(1, rest) -- the coarser of the source's
  pixels and the layout's resting picture. Capping the total past the source's pixels
  instead would leave a full 9:16 short (1.78x at rest) and a desktop clip from 720
  windows (1.5x) no zoom at all; knobs.md says so and gives the numbers.
- The push is drawn by perspective on sub-pixel corners (cubic), enabled only over the
  push, not zoompan (which rounds its crop to whole pixels: a slow ease stepped back by
  up to 1.5 px). A render test measures a 4 s push's edge every frame: no back-step,
  the held place exact, the frame untouched outside it.
- The writer refuses a zoom outside the clip's cut (a build still checks the window).
- A cold open with a gap inside or across it, or equal to the whole cut, is refused at
  write time and at a build, naming the clip and the gap (never the internal id).
- A batch record's look keeps its fonts by name (the pipeline's fonts/) or relative to
  the project; --again resolves them.

Co-Authored-By: Claude <noreply@anthropic.com>

Diffstat:
Meditor/CHANGELOG.md | 8++++++--
Mumtool/components/projects/report/LookPanel.tsx | 8++++----
Mumtool/docs/knobs.md | 36++++++++++++++++++++++++++----------
Mumtool/lib/report/clipKit.test.mjs | 18++++++++++++++++--
Mumtool/lib/report/manifest.mjs | 2+-
Mumtool/lib/report/shortsBatch.test.mjs | 13+++++++++++++
Mumtool/lib/report/verticalCli.mjs | 31++++++++++++++++++++++++++++---
Mumtool/report-to-video/build-video.mjs | 2+-
Mumtool/report-to-video/clip-kit.mjs | 16+++++++++++++---
Mumtool/report-to-video/clip-zoom.mjs | 76++++++++++++++++++++++++++++++++++++++++++++++++----------------------------
Mumtool/report-to-video/clip-zoom.test.mjs | 69+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------
Mumtool/report-to-video/cold-open.test.mjs | 9+++++++++
12 files changed, 226 insertions(+), 62 deletions(-)

diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md @@ -23,6 +23,7 @@ - The cold open has its own captions and sound, the hook band, no code and no card. The channel promo still ends the clip. - Set it with the clip editor's **Cold open from selection** or `umtool set <p> <clip> coldOpen.from=… coldOpen.to=…`. + - A cold open with a gap inside it or across its edges, or one that is the whole cut, is refused by the clip's name. - Turn it off for a build with `--no-cold-open`. - Reels, `--landscape` and the stacked deck play the clips as cut. - **umtool: a short or a desktop clip can zoom in at points.** A clip's `zooms` @@ -31,8 +32,11 @@ on screen. - It is strict by default: a zoom past the source's own pixels is refused, naming the enlargement. With 1080 windows a framed short has room up to ×1.78; a full short and a desktop clip have none. - - `render.zooms.maxScale` (up to 1.3) allows a soft zoom past that limit, and the build says how much softer than - its source it plays. + - `render.zooms.soften` (up to 1.3) allows a soft zoom: the picture may play up to that many times the coarser of + its source's pixels and the layout's resting picture. The build says how much softer than its source it plays. + It is not a cap on the total past the source's pixels, which would leave a full short no zoom at all (knobs.md). + - The push is drawn on sub-pixel corners, so a slow ease never steps back. A zoom written outside the clip's cut + is refused. - Controls: the clip editor's **Zoom here** (scale, focus, hold), the Look panel's **Zooms**, and `umtool set <p> <clip> zooms=…`. - **umtool: a clip can end on the channel's card, for promoting the streamer it was clipped from.** `render.promo` diff --git a/umtool/components/projects/report/LookPanel.tsx b/umtool/components/projects/report/LookPanel.tsx @@ -44,7 +44,7 @@ type Look = { blur?: string; intro?: string | { style?: string; [k: string]: unknown } | null; promo?: Promo | null; - zooms?: { maxScale?: number } | null; + zooms?: { soften?: number } | null; desktop?: { tag?: boolean; qr?: boolean | { corner?: string; size?: number; links?: string }; captions?: { size?: string; lines?: number }; [k: string]: unknown } | null; }; type Mode = "deck" | "basic"; @@ -184,7 +184,7 @@ function draftOf(l: Look, mode: Mode = "deck"): Draft { deskQr: deskQrOf(l.desktop), deskSize: l.desktop?.captions?.size ?? "l", ...promoDraftOf(l.promo), - zoomSoft: String(l.zooms?.maxScale ?? 1), + zoomSoft: String(l.zooms?.soften ?? 1), }; } @@ -239,8 +239,8 @@ function patchOf(was: Look, d: Draft, view: View): Record<string, unknown> { const next = promoNext(was.promo, d); if (JSON.stringify(next ?? null) !== JSON.stringify(was.promo ?? null)) p.promo = next; } - // The zooms' soft limit (render.zooms.maxScale, clip-zoom.mjs): 1 (strict) is no key. - if (Number(d.zoomSoft) !== (was.zooms?.maxScale ?? 1)) p.zooms = Number(d.zoomSoft) === 1 ? null : { maxScale: Number(d.zoomSoft) }; + // The zooms' soft limit (render.zooms.soften, clip-zoom.mjs): 1 (strict) is no key. + if (Number(d.zoomSoft) !== (was.zooms?.soften ?? 1)) p.zooms = Number(d.zoomSoft) === 1 ? null : { soften: Number(d.zoomSoft) }; // The desktop clips (render.desktop, the clip kit): the source line, a code, the captions' size. { const next = desktopNext(was.desktop, d); diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md @@ -467,22 +467,36 @@ and out (lane clip-kit; `report-to-video/clip-zoom.mjs`). The push is in SOURCE The captions, the source line, the code and the promo card never zoom. A whole cut's punch-ins are the deck's `fx.punchIn` (Effects), not these. -**Sharp by default.** A layout already shows its source at some enlargement: a 1080 window fitted into a framed -short's 1080x608 box 0.56×, cut 9:16 to fill 1080x1920 1.78×, a desktop clip 1.0×. A zoom multiplies it. A zoom past -the source's own pixels is refused, by name, with the enlargement it would play at. With 1080 windows -(`render.tallWindows`) a framed short has room up to ×1.78 (720 windows: ×1.19); a full short and a desktop clip have -none. `render.zooms.maxScale` (up to 1.3) lets a project go that much past the sharp limit, and the build says how -much softer than its source each such zoom plays. +**Sharp by default.** A layout already shows its source at some enlargement, its REST: a 1080 window fitted into a +framed short's 1080x608 box 0.56×, cut 9:16 to fill 1080x1920 1.78×, a desktop clip 1.0× (from 720 windows 1.5× each +of those). A zoom multiplies it: the picture plays at rest × scale its source's pixels. The REFERENCE is the coarser +of the source's own pixels and the layout's resting picture, max(1, rest); a strict cut never plays past it, so a zoom +that would is refused, by name, with the enlargement it would play at. With 1080 windows (`render.tallWindows`) a +framed short has room up to ×1.78 (720 windows: ×1.19); a full short and a desktop clip have none. + +**Soft: `render.zooms.soften`** (1–1.3) lets a zoom play up to that many times the reference: rest × scale ≤ soften × +max(1, rest), and the build says how much softer than its source each such zoom plays. For a framed short (rest +under 1) that caps the TOTAL enlargement past the source's pixels at `soften` (×1.3: a scale up to 2.31 from 1080 +windows); for a full 9:16 short or a desktop clip from 720 windows -- already past the source's pixels at rest -- it +lets the picture go `soften` times softer than it already plays (×1.3: scale 1.3, a full short from 1080 windows at +2.31× its pixels). It is deliberately NOT a cap on the total past the source's pixels in every layout: capped at 1.3, +a full short (1.78× at rest) and a desktop clip from 720 windows (1.5×) could not zoom at all. + +**Smooth.** The push is drawn by ffmpeg's `perspective` on sub-pixel corners (cubic), only over the push -- not +`zoompan`, which rounds its crop to whole pixels each frame, so a slow ease stepped back and forth. + +**Written against the cut.** The clip editor and `umtool set` refuse a zoom outside the clip's cut (`cutStart`– +`cutEnd`); a build checks only the window, and a cut tightened since leaves the zoom out, said. | Knob | Values (default) | What it does | |---|---|---| | a clip's `zooms` | `[{at, hold?, scale?, focus?, box?, ramp?}]`, 1–8, none overlapping | `at` the source second the push starts; `hold` 0.3–10 s at full zoom (1.5); `scale` 1.05–3 (1.3) and `focus` `[x, y]` (fractions of the picture; its centre), or `box` `[x, y, w, h]`, the part of the picture to fill the frame with; `ramp` 0.2–1 s each way (0.4, smoothstep) | -| `render.zooms.maxScale` | 1–1.3 (absent: 1, strict) | how far past the source's pixels a zoom may go | +| `render.zooms.soften` | 1–1.3 (absent: 1, strict) | how many times the reference, max(1, rest), a zoom may play its source at | | | In umtool | From a terminal | |---|---|---| | a zoom | the clip editor's **Short**: **Zoom here** (at the playhead), its scale, focus (%) and hold; × takes it off | `umtool set <p> <clip> zooms='[{"at":231.4,"scale":1.3,"focus":[0.7,0.35]}]'` (`zooms=` none) | -| the soft limit | Build, **Look**: **Zooms** (never / up to ×1.15 / up to ×1.3 soft) | `umtool look <p> zooms='{"maxScale":1.3}'` (`zooms=` strict) | +| the soft limit | Build, **Look**: **Zooms** (never / up to ×1.15 / up to ×1.3 soft) | `umtool look <p> zooms='{"soften":1.3}'` (`zooms=` strict) | The cut record names each zoom drawn (`zooms: [{at, scale, focus, hold, ramp, enlargement}]`, `at` on the segment's clock). @@ -491,8 +505,10 @@ clock). A short or a desktop clip can open on a moment of its clip -- the payoff line -- and then cut to the clip's start (lane clip-kit; `report-to-video/vertical-plan.mjs` `coldOpenEntry`). A clip's `coldOpen: {from, to}` (source seconds -of its cut, 1–4 s; 1.5–3 s reads best, said otherwise) is cut out as an entry of its own, `<clip>~co`, played first -with a hard cut into the clip: +of its cut, 1–4 s; 1.5–3 s reads best, said otherwise) is cut out as an entry of its own, played first with a hard cut +into the clip. Refused when written (and at a build), naming the clip: one outside the cut, one that is the whole +cut, and one with a gap (a jump cut taken out) inside it or across its edges -- never a cold open silently shorter. +It plays: - its own words captioned and its own sound (each piece's edges faded a few hundredths of a second, as any short's); - the hook band over it; no code (the clip's code shows from the clip on) and no card (the channel promo is the diff --git a/umtool/lib/report/clipKit.test.mjs b/umtool/lib/report/clipKit.test.mjs @@ -80,8 +80,15 @@ test("a clip's zooms written: whole, checked against its window and each other; await assert.rejects(updateClip(dir, "w01", { zooms: [{ at: 11 }, { at: 12 }] }), /starts before the one at 11 s is out again/); await updateClip(dir, "w01", { zooms: [] }); assert.equal("zooms" in (await read(dir)), false); - await assert.rejects(updateRender(dir, { zooms: { maxScale: 2 } }), /maxScale is 1–1\.3/); - assert.deepEqual((await updateRender(dir, { zooms: { maxScale: 1.3 } })).look.zooms, { maxScale: 1.3 }); + // Written, a zoom is checked against the CUT: one inside the window the cut does not play is refused. + const m = manifest(); + Object.assign(m.timeline[0], { cutStart: 12, cutEnd: 17 }); + await writeFile(path.join(dir, MANIFEST_NAME), JSON.stringify(m, null, 2) + "\n"); + await assert.rejects(updateClip(dir, "w01", { zooms: [{ at: 16 }] }), /w01\.zooms\[0\] \(16–18\.3 s\) runs outside the clip's cut \(12–17\)/); + await assert.rejects(updateClip(dir, "w01", { zooms: [{ at: 11 }] }), /runs outside the clip's cut \(12–17\)/); + await updateClip(dir, "w01", { zooms: [{ at: 12.5 }] }); + await assert.rejects(updateRender(dir, { zooms: { soften: 2 } }), /soften is 1–1\.3/); + assert.deepEqual((await updateRender(dir, { zooms: { soften: 1.3 } })).look.zooms, { soften: 1.3 }); } finally { await rm(dir, { recursive: true, force: true }); } @@ -95,6 +102,13 @@ test("a clip's cold open written: both fields in one patch, inside its cut, 1-4 assert.deepEqual((await read(dir)).coldOpen, { from: 17, to: 19.5 }); await assert.rejects(updateClip(dir, "w01", { "coldOpen.to": 25 }), /w01\.coldOpen is 8 s: a cold open is 1–4 s/); await assert.rejects(updateClip(dir, "w01", { coldOpen: { from: 19, to: 21 } }), /outside the clip's cut \(10–20\)/); + // Across a gap, or the whole cut: refused at write time, naming the clip and the gap. + const m = manifest(); + Object.assign(m.timeline[0], { cutStart: 12, cutEnd: 15, gaps: [{ from: 13.5, to: 14 }] }); + await writeFile(path.join(dir, MANIFEST_NAME), JSON.stringify(m, null, 2) + "\n"); + await assert.rejects(updateClip(dir, "w01", { coldOpen: { from: 13, to: 14.5 } }), /w01\.coldOpen \(13–14\.5\) runs across w01's gap 13\.5–14 s/); + await assert.rejects(updateClip(dir, "w01", { coldOpen: { from: 12, to: 15 } }), /w01\.coldOpen \(12–15\) is the whole cut/); + await assert.doesNotReject(updateClip(dir, "w01", { coldOpen: { from: 12, to: 13.4 } })); await updateClip(dir, "w01", { coldOpen: null }); assert.equal("coldOpen" in (await read(dir)), false); } finally { diff --git a/umtool/lib/report/manifest.mjs b/umtool/lib/report/manifest.mjs @@ -873,7 +873,7 @@ export function patchClipEntry(manifest, clipId, patch, { edit = "trim", now = n } if (next === null || (isObj(next) && !Object.keys(next).length) || (Array.isArray(next) && !next.length)) delete entry[key]; else entry[key] = typeof next === "string" ? next.trim() : next; - const errors = clipKitErrors(entry, clipId); + const errors = clipKitErrors(entry, clipId, { writer: true }); if (errors.length) throw new Error(errors.join("; ")); } diff --git a/umtool/lib/report/shortsBatch.test.mjs b/umtool/lib/report/shortsBatch.test.mjs @@ -282,3 +282,16 @@ test("hidden regions reach a short of a RENDERED take (its render frozen): the t await rm(w.root, { recursive: true, force: true }); } }); + +test("a record's look keeps its fonts by name (the pipeline's) or relative to the project, never this checkout's path; --again resolves them", async () => { + const { lookSnapshotOf, lookFromSnapshot } = await import("./verticalCli.mjs"); + const { MONO_FONT_FILE, MONO_BOLD_FONT_FILE } = await import("umtool-report-to-video/brand"); + const dir = "/somewhere/reports/proj"; + const look = lookSnapshotOf({ fontRegular: MONO_FONT_FILE, fontBold: `${dir}/fonts/Own-Bold.ttf`, palette: { bg: "#000000" }, width: 1920 }, { projectDir: dir }); + assert.deepEqual(look, { fontRegular: "IBMPlexMono-Regular.ttf", fontBold: "fonts/Own-Bold.ttf", palette: { bg: "#000000" } }); + assert.ok(!JSON.stringify(look).includes(path.dirname(MONO_FONT_FILE)), "no absolute path of this checkout"); + assert.deepEqual(lookFromSnapshot(look, { projectDir: dir }), { fontRegular: MONO_FONT_FILE, fontBold: `${dir}/fonts/Own-Bold.ttf`, palette: { bg: "#000000" } }); + assert.equal(lookFromSnapshot({ fontBold: "IBMPlexMono-Bold.ttf" }, { projectDir: dir }).fontBold, MONO_BOLD_FONT_FILE); + // A font elsewhere on the machine stays as written (there is no name to give it). + assert.equal(lookSnapshotOf({ fontRegular: "/usr/share/fonts/X.ttf" }, { projectDir: dir }).fontRegular, "/usr/share/fonts/X.ttf"); +}); diff --git a/umtool/lib/report/verticalCli.mjs b/umtool/lib/report/verticalCli.mjs @@ -29,7 +29,32 @@ import { ensureWriteDir } from "./storage.mjs"; * render draws a per-clip build with, as the take resolved them then. */ export const LOOK_SNAPSHOT_KEYS = Object.freeze(["palette", "fontRegular", "fontBold", "fps", "captions", "loudness", "qr", "vertical", "desktop", "promo", "zooms", "tallWindows", "maxHeightSource", "blur", "transition", "transitionStyle", "headerHeight", "footerHeight"]); -export const lookSnapshotOf = (render) => Object.fromEntries(LOOK_SNAPSHOT_KEYS.filter((k) => render?.[k] !== undefined).map((k) => [k, render[k]])); +const FONT_KEYS = ["fontRegular", "fontBold"]; +const PIPELINE_FONTS = path.join(/* turbopackIgnore: true */ PIPELINE_DIR, "fonts"); +/** + * The snapshot of `render`'s look. Its fonts are kept BY NAME (one of the pipeline's fonts/: its file name) or + * relative to the project (`projectDir`), never as an absolute path of this checkout -- a record outlives a move. + */ +export function lookSnapshotOf(render, { projectDir = null } = {}) { + const out = Object.fromEntries(LOOK_SNAPSHOT_KEYS.filter((k) => render?.[k] !== undefined).map((k) => [k, render[k]])); + for (const k of FONT_KEYS) { + const v = out[k]; + if (typeof v !== "string" || !path.isAbsolute(v)) continue; + if (path.dirname(v) === PIPELINE_FONTS) out[k] = path.basename(v); + else if (projectDir && !path.relative(projectDir, v).startsWith("..")) out[k] = path.relative(projectDir, v); + } + return out; +} +/** A recorded look made usable again: a font by name is the pipeline's, a relative one the project's. */ +export function lookFromSnapshot(look, { projectDir }) { + const out = { ...look }; + for (const k of FONT_KEYS) { + const v = out[k]; + if (typeof v !== "string" || path.isAbsolute(v)) continue; + out[k] = !v.includes("/") && existsSync(path.join(/* turbopackIgnore: true */ PIPELINE_FONTS, v)) ? path.join(/* turbopackIgnore: true */ PIPELINE_FONTS, v) : path.join(/* turbopackIgnore: true */ projectDir, v); + } + return out; +} export const VERTICAL_USAGE = [ "usage: umtool vertical <project> --take <t> (--reel <r> | --beats FILE | --items <id>,<id>…)", @@ -266,7 +291,7 @@ export async function buildShort(o, { reportsRoot = REPORTS_ROOT, say = () => {} // region hidden since must never show in a short of it. ADD-ONLY: the take's own boxes stay. const takeManifest0 = withProjectCensor(takeManifestFrozen, projectManifest0?.render?.censor); // A rebuild from a batch's record (`o.look`, LOOK_SNAPSHOT_KEYS) lays the look it was built with over the take's. - const takeManifest = isObj(o.look) ? { ...takeManifest0, render: { ...(takeManifest0.render ?? {}), ...o.look } } : takeManifest0; + const takeManifest = isObj(o.look) ? { ...takeManifest0, render: { ...(takeManifest0.render ?? {}), ...lookFromSnapshot(o.look, { projectDir: dir }) } } : takeManifest0; const projectManifest = await readJson(path.join(dir, "video.manifest.json")); const outDir = path.join(takeDir, "out"); const sourced = path.join(outDir, "sourced"); @@ -443,7 +468,7 @@ export async function buildShort(o, { reportsRoot = REPORTS_ROOT, say = () => {} const record = { version: 1, kind: "vertical-short", project: r.project.id, take, name, layout: tag, reframe, knobs, ...(o.promo === false ? { promo: false } : o.promoKnobs ? { promo: o.promoKnobs } : {}), ...(o.coldOpen === false ? { coldOpen: false } : {}), pieces: plan.pieces, ...(wrapped.intro ? { intro: wrapped.intro } : {}), ...(wrapped.outro ? { outro: wrapped.outro } : {}), seconds: made.seconds, loudness: made.loudness ?? null, - look: lookSnapshotOf(takeManifest.render), + look: lookSnapshotOf(takeManifest.render, { projectDir: dir }), notes: [...notes, ...V.verticalNotes({ format: "vertical", vertical: desktop ? { maxSeconds: V.desktopKnobs({ desktop: { ...(takeManifest.render?.desktop ?? {}), ...dknobs } }).maxSeconds } : knobs }, made.seconds)], out: outFile, madeAt: new Date().toISOString(), buildSeconds: Math.round((Date.now() - started) / 1000), }; diff --git a/umtool/report-to-video/build-video.mjs b/umtool/report-to-video/build-video.mjs @@ -1881,7 +1881,7 @@ async function buildClipSegment(entry, meta, render, dirs, opts, chrome, nodes, let zoom = []; if (Array.isArray(entry.zooms) && entry.zooms.length) { const { region, rest } = pictureRegion(geo, sw, sh, entry.vertical?.crop ?? null); - const z = resolveZooms(entry, { from: cutRecord.start, gaps: cutRecord.gaps ?? [], srcW: sw, srcH: sh, region, rest, maxScale: render.zooms?.maxScale ?? 1, seconds: segSeconds }); + const z = resolveZooms(entry, { from: cutRecord.start, gaps: cutRecord.gaps ?? [], srcW: sw, srcH: sh, region, rest, soften: render.zooms?.soften ?? 1, seconds: segSeconds }); if (z.errors.length) throw new Error(`zooms: ${z.errors.join("; ")}`); for (const message of z.notes) EMIT("note", { message }); zoom = zoomFilters(z.zooms, { srcW: sw, srcH: sh, fps: render.fps }); diff --git a/umtool/report-to-video/clip-kit.mjs b/umtool/report-to-video/clip-kit.mjs @@ -54,7 +54,7 @@ export function qrSettingsErrors(qr, where = "render.qr") { } /** Each thing wrong with a clip's kit keys ([] when fine), named `<where>.<key>`. */ -export function clipKitErrors(entry, where = "clip") { +export function clipKitErrors(entry, where = "clip", { writer = false } = {}) { const errors = []; if (!isObj(entry)) return errors; if (entry.qr !== undefined && entry.qr !== false) { @@ -69,8 +69,9 @@ export function clipKitErrors(entry, where = "clip") { } // Its channel promo (promo-card.mjs): false, or its own timing. errors.push(...clipPromoErrors(entry.promo, `${where}.promo`)); - // Its zooms (clip-zoom.mjs), against its window. - errors.push(...zoomsErrors(entry.zooms, `${where}.zooms`, entry)); + // Its zooms (clip-zoom.mjs): against its cut when written (a zoom the cut does not play is refused), against its + // window at a build (a cut tightened since leaves one out, said). + errors.push(...zoomsErrors(entry.zooms, `${where}.zooms`, entry, { cut: writer })); // Its cold open: a span of its own cut, played first. errors.push(...coldOpenErrors(entry.coldOpen, `${where}.coldOpen`, entry)); // Its hidden regions (clip-censor.mjs). @@ -98,6 +99,15 @@ export function coldOpenErrors(v, where = "clip.coldOpen", entry = null) { const a = num(entry?.cutStart) ? entry.cutStart : entry?.start; const b = num(entry?.cutEnd) ? entry.cutEnd : entry?.end; if (num(a) && num(b) && (v.from < a - 0.02 || v.to > b + 0.02)) errors.push(`${where} (${v.from}–${v.to}) is outside the clip's cut (${a}–${b})`); + else if (num(a) && num(b) && v.from <= a + 0.02 && v.to >= b - 0.02) errors.push(`${where} (${v.from}–${v.to}) is the whole cut: a cold open plays a part of it first`); + // A gap (a jump cut taken out of the clip) inside or across it: refused, never a cold open silently shorter. + const clip = where.replace(/\.coldOpen$/, "").replace(/^timeline /, ""); + for (const g of Array.isArray(entry?.gaps) ? entry.gaps : []) { + if (!num(g?.from) || !num(g?.to)) continue; + if (g.from < v.to - 0.02 && g.to > v.from + 0.02) { + errors.push(`${where} (${v.from}–${v.to}) runs across ${clip}'s gap ${g.from}–${g.to} s (a jump cut taken out): move it off the gap, or take the gap out`); + } + } return errors; } diff --git a/umtool/report-to-video/clip-zoom.mjs b/umtool/report-to-video/clip-zoom.mjs @@ -8,20 +8,25 @@ // focus the point that stays where it is on screen, fractions of the source picture ([0.5, 0.5]; a box's // centre) // ramp the ease in, and out again (0.2–1 s; 0.4; smoothstep) -// render.zooms { maxScale?: 1–1.3 } how far past the source's own pixels a zoom may go (absent: 1, strict) +// render.zooms { soften?: 1–1.3 } how much softer than the layout's resting picture a zoom may play (absent: 1) // // IN SOURCE SPACE, BEFORE THE LAYOUT. The picture is pushed in about `focus` and the layout then cuts it as it always // does: a short's 9:16 crop (`vertical.crop`) is the same box, the focus keeps its place on screen and the picture // grows around it; a desktop clip's full frame likewise. Captions, the source line, the code and the promo card are // drawn after it and never zoom. // -// SHARP. A layout already shows its source at some enlargement (a 1080 window fitted into the 1080x608 box of a -// framed short: 0.56; cropped 9:16 to fill 1080x1920: 1.78; a desktop clip: 1.0). A zoom multiplies it. The sharp -// limit is the scale at which the picture reaches the source's own pixels: max(1, 1 / rest). Past it is refused, -// by name -- unless the project allows a SOFT zoom, `render.zooms.maxScale` (up to 1.3 times the sharp limit), and -// then the build says how much softer than its source the zoom plays. +// SHARP. A layout already shows its source at some enlargement, `rest` (a 1080 window fitted into the 1080x608 box +// of a framed short: 0.56; cropped 9:16 to fill 1080x1920: 1.78; a desktop clip: 1.0; from a 720 window 1.5× that). +// A zoom multiplies it: the picture plays at rest × scale its source's pixels. THE REFERENCE is the coarser of the +// source's own pixels and the layout's resting picture, max(1, rest): a zoom may play its source at no more than +// that -- the sharp limit is the scale that reaches it, max(1, 1 / rest), so where the layout already enlarges (a +// full 9:16 crop, a desktop clip from a 720 window) a strict cut cannot zoom. Past it is refused, by name -- unless +// the project allows a SOFT zoom, `render.zooms.soften` (1–1.3): the picture may then play up to `soften` times the +// reference (rest × scale ≤ soften × max(1, rest)), and the build says how much softer than its source it plays. +// NOT a cap on the total enlargement past the source's pixels: a full 9:16 crop already plays its 1080 source at +// 1.78×, and capping that total at 1.3 would leave a full short (and a desktop clip from 720 windows) no zoom at all. // -// PURE: no fs, no ffmpeg run. The build (build-video.mjs) draws it with ffmpeg's zoompan. +// PURE: no fs, no ffmpeg run. The build (build-video.mjs) draws it with ffmpeg's perspective (zoomFilters). import { offsetIn } from "./gaps.mjs"; const isObj = (v) => v !== null && typeof v === "object" && !Array.isArray(v); @@ -34,14 +39,17 @@ export const ZOOM_LIMITS = Object.freeze({ ramp: Object.freeze({ min: 0.2, max: 1, default: 0.4 }), }); export const ZOOMS_MAX = 8; -/** `render.zooms.maxScale`: the soft limit, times the sharp limit (1: strict). */ +/** `render.zooms.soften`: how far past the reference, max(1, rest), a zoom may play its source (1: strict). */ export const ZOOM_SOFT = Object.freeze({ min: 1, max: 1.3, default: 1 }); /** A zoom's span on a clock: from `at`, eased in over `ramp`, held, eased out over `ramp`. */ export const zoomEnd = (z) => z.at + 2 * (z.ramp ?? ZOOM_LIMITS.ramp.default) + (z.hold ?? ZOOM_LIMITS.hold.default); -/** Each thing wrong with a clip's `zooms` ([] when fine, or absent). `entry` its window (start, end), when known. */ -export function zoomsErrors(zooms, where = "clip.zooms", entry = null) { +/** + * Each thing wrong with a clip's `zooms` ([] when fine, or absent). `entry` its window (start, end), when known; + * `cut` (the writer): against its cut (cutStart–cutEnd, else its window), a zoom it does not play refused. + */ +export function zoomsErrors(zooms, where = "clip.zooms", entry = null, { cut = false } = {}) { if (zooms === undefined) return []; if (!Array.isArray(zooms) || !zooms.length || zooms.length > ZOOMS_MAX) return [`${where} is a list of 1 to ${ZOOMS_MAX} zooms [{at, hold?, scale?, focus?, box?, ramp?}]`]; const errors = []; @@ -50,8 +58,11 @@ export function zoomsErrors(zooms, where = "clip.zooms", entry = null) { if (!isObj(z)) return errors.push(`${w} is {at, hold?, scale?, focus?, box?, ramp?}`); for (const k of Object.keys(z)) if (!ZOOM_KEYS.includes(k)) errors.push(`${w}.${k} is not a key (${ZOOM_KEYS.join(", ")})`); if (!num(z.at) || z.at < 0) errors.push(`${w}.at is a source second`); - else if (entry && num(entry.start) && num(entry.end) && (z.at < entry.start - 0.02 || zoomEnd(z) > entry.end + 0.02)) { - errors.push(`${w} (${z.at}–${Math.round(zoomEnd(z) * 100) / 100} s) runs outside the clip's window (${entry.start}–${entry.end})`); + else if (entry && num(entry.start) && num(entry.end)) { + const a = cut && num(entry.cutStart) ? entry.cutStart : entry.start; + const b = cut && num(entry.cutEnd) ? entry.cutEnd : entry.end; + const span = cut && (num(entry.cutStart) || num(entry.cutEnd)) ? "cut" : "window"; + if (z.at < a - 0.02 || zoomEnd(z) > b + 0.02) errors.push(`${w} (${z.at}–${Math.round(zoomEnd(z) * 100) / 100} s) runs outside the clip's ${span} (${a}–${b})`); } for (const [k, b] of Object.entries(ZOOM_LIMITS)) if (z[k] !== undefined && !(num(z[k]) && z[k] >= b.min && z[k] <= b.max)) errors.push(`${w}.${k} is ${b.min}–${b.max}`); if (z.focus !== undefined && !(Array.isArray(z.focus) && z.focus.length === 2 && z.focus.every((n) => num(n) && n >= 0 && n <= 1))) errors.push(`${w}.focus is [x, y], fractions of the picture`); @@ -71,11 +82,11 @@ export function zoomsErrors(zooms, where = "clip.zooms", entry = null) { /** Each thing wrong with `render.zooms` ([] when fine, or absent). */ export function renderZoomsErrors(v, where = "render.zooms") { if (v === undefined || v === null) return []; - if (!isObj(v)) return [`${where} is {maxScale}`]; + if (!isObj(v)) return [`${where} is {soften}`]; const errors = []; - for (const k of Object.keys(v)) if (k !== "maxScale") errors.push(`${where}.${k} is not a key (maxScale)`); - if (v.maxScale !== undefined && !(num(v.maxScale) && v.maxScale >= ZOOM_SOFT.min && v.maxScale <= ZOOM_SOFT.max)) { - errors.push(`${where}.maxScale is ${ZOOM_SOFT.min}–${ZOOM_SOFT.max}: how far past the source's own pixels a zoom may go (1: never)`); + for (const k of Object.keys(v)) if (k !== "soften") errors.push(`${where}.${k} is not a key (soften)`); + if (v.soften !== undefined && !(num(v.soften) && v.soften >= ZOOM_SOFT.min && v.soften <= ZOOM_SOFT.max)) { + errors.push(`${where}.soften is ${ZOOM_SOFT.min}–${ZOOM_SOFT.max}: how much softer than the layout's resting picture (or the source's own pixels, if sharper) a zoom may play (1: never)`); } return errors; } @@ -104,16 +115,16 @@ export const sharpLimit = (rest) => Math.max(1, 1 / rest); /** * Each zoom resolved for a segment (PURE): its clock in the segment's seconds (`from` the source second it starts at, * `gaps` the cut's), its scale (a box's derived from the region the layout shows) and focus, and how sharp it plays. - * `region` px of the source the layout shows ({x, y, w, h}); `rest` its enlargement; `maxScale` the soft limit. + * `region` px of the source the layout shows ({x, y, w, h}); `rest` its enlargement; `soften` the soft limit. * Returns `{zooms, errors, notes}`: a zoom past its limit is an error naming it, one past the sharp limit (soft, * allowed) a note. */ -export function resolveZooms(entry, { from, gaps = [], srcW, srcH, region, rest, maxScale = 1, seconds = Infinity, id = entry?.id ?? "clip" }) { +export function resolveZooms(entry, { from, gaps = [], srcW, srcH, region, rest, soften = 1, seconds = Infinity, id = entry?.id ?? "clip" }) { const zooms = []; const errors = []; const notes = []; const sharp = sharpLimit(rest); - const ceiling = sharp * Math.max(1, Math.min(ZOOM_SOFT.max, maxScale)); + const ceiling = sharp * Math.max(1, Math.min(ZOOM_SOFT.max, soften)); const round = (n) => Math.round(n * 100) / 100; for (const z of Array.isArray(entry?.zooms) ? entry.zooms : []) { const ramp = z.ramp ?? ZOOM_LIMITS.ramp.default; @@ -138,8 +149,8 @@ export function resolveZooms(entry, { from, gaps = [], srcW, srcH, region, rest, continue; } if (scale > ceiling + 1e-6) { - const ways = ["a smaller zoom", "a sharper source (render.tallWindows)", ...(maxScale < ZOOM_SOFT.max ? [`a soft limit (umtool look <p> zooms='{"maxScale":${ZOOM_SOFT.max}}')`] : [])]; - errors.push(`${what} plays its source at ${round(rest * scale)}× its pixels; the limit here is ×${round(ceiling)} (${maxScale > 1 ? `render.zooms.maxScale ${maxScale} times ` : ""}the sharp ×${round(sharp)}) -- ${ways.join(", ")}`); + const ways = ["a smaller zoom", "a sharper source (render.tallWindows)", ...(soften < ZOOM_SOFT.max ? [`a soft limit (umtool look <p> zooms='{"soften":${ZOOM_SOFT.max}}')`] : [])]; + errors.push(`${what} plays its source at ${round(rest * scale)}× its pixels; the limit here is ×${round(ceiling)} (${soften > 1 ? `render.zooms.soften ${soften} times ` : ""}the sharp ×${round(sharp)}) -- ${ways.join(", ")}`); continue; } if (rest * scale > 1.001) notes.push(`${what} plays softer than its source: ${round(rest * scale)}× its pixels`); @@ -163,16 +174,25 @@ function pushExpr(z, t) { } /** - * The zoom as ONE ffmpeg filter chain on the source picture (PURE): its frames at `fps`, then zoompan with the zoom - * and the focus kept in place (each push its own focus; between them, none). Empty when there are no zooms. + * The zoom as ONE ffmpeg filter chain on the source picture (PURE): its frames at `fps`, then the part of the picture + * the zoom shows mapped onto the whole frame by `perspective` -- its corners in SUB-PIXEL source coordinates, + * interpolated (cubic), re-evaluated each frame on the frame count -- and only over the pushes (`enable`): between + * them the frame passes untouched. Not zoompan, which rounds its crop's x, y and size to whole pixels each frame, so + * a slow ease steps back and forth (a wobble). The focus stays where it is on screen: the shown part starts at + * focus × (1 − 1/zoom) of the picture. Empty when there are no zooms. */ export function zoomFilters(zooms, { srcW, srcH, fps }) { if (!zooms?.length) return []; - const t = "it"; + const t = `(in/${fps})`; const Z = `(1+${zooms.map((z) => pushExpr(z, t)).join("+")})`; - // The focus of the push under way (a nested choice by span); outside every push the zoom is 1 and it does not matter. + // The focus of the push under way (a nested choice by span); outside every push the filter is off. const pick = (k) => zooms.reduceRight((acc, z) => `if(between(${t},${f(z.at)},${f(zoomEnd(z))}),${f(z.focus[k])},${acc})`, "0.5"); - const x = `${pick(0)}*iw*(1-1/zoom)`; - const y = `${pick(1)}*ih*(1-1/zoom)`; - return [`fps=${fps}`, `zoompan=z='${Z}':x='${x}':y='${y}':d=1:s=${srcW}x${srcH}:fps=${fps}`]; + const x = `${pick(0)}*W*(1-1/${Z})`; + const y = `${pick(1)}*H*(1-1/${Z})`; + const r = `${x}+W/${Z}`; + const b = `${y}+H/${Z}`; + const on = zooms.map((z) => `between(n/${fps},${f(z.at)},${f(zoomEnd(z))})`).join("+"); + void srcW; + void srcH; + return [`fps=${fps}`, `perspective=x0='${x}':y0='${y}':x1='${r}':y1='${y}':x2='${x}':y2='${b}':x3='${r}':y3='${b}':interpolation=cubic:sense=source:eval=frame:enable='${on}'`]; } diff --git a/umtool/report-to-video/clip-zoom.test.mjs b/umtool/report-to-video/clip-zoom.test.mjs @@ -1,6 +1,7 @@ // Zoom at points (lane clip-kit, slice F): the rules, the sharp and the soft limits, the eased expression. import { test } from "node:test"; import assert from "node:assert/strict"; +import { spawnSync } from "node:child_process"; import { renderZoomsErrors, resolveZooms, restEnlargement, sharpLimit, validateZooms, zoomEnd, zoomFilters, zoomsErrors } from "./clip-zoom.mjs"; import { clipGeometry, desktopGeometry, pictureRegion } from "./vertical.mjs"; @@ -13,6 +14,11 @@ test("the rules: a list of 1 to 8, inside the window, none overlapping; a box or no([], /a list of 1 to 8/); no(Array.from({ length: 9 }, (_, i) => ({ at: 11 + i * 3 })), /a list of 1 to 8/); no([{ at: 39.5 }], /runs outside the clip's window/); + // The writer checks the cut; a build the window (a cut tightened since leaves it out, said). + const cut = clip(undefined, { cutStart: 15, cutEnd: 30 }); + assert.match(zoomsErrors([{ at: 29 }], "z", cut, { cut: true }).join(), /z\[0\] \(29–31\.3 s\) runs outside the clip's cut \(15–30\)/); + assert.match(zoomsErrors([{ at: 12 }], "z", cut, { cut: true }).join(), /runs outside the clip's cut/); + assert.deepEqual(zoomsErrors([{ at: 29 }], "z", cut), [], "a build: inside its window"); no([{ at: 12, scale: 5 }], /scale is 1\.05–3/); no([{ at: 12, focus: [2, 0] }], /focus is \[x, y\]/); no([{ at: 12, box: [0.9, 0, 0.3, 0.3] }], /box is \[x, y, w, h\]/); @@ -20,8 +26,8 @@ test("the rules: a list of 1 to 8, inside the window, none overlapping; a box or no([{ at: 12 }, { at: 13 }], /starts before the one at 12 s is out again \(14\.3 s\)/); no([{ at: 12, wobble: 1 }], /wobble is not a key/); assert.equal(zoomEnd({ at: 12 }), 14.3); - assert.deepEqual(renderZoomsErrors({ maxScale: 1.3 }), []); - assert.match(renderZoomsErrors({ maxScale: 2 }).join(), /maxScale is 1–1\.3/); + assert.deepEqual(renderZoomsErrors({ soften: 1.3 }), []); + assert.match(renderZoomsErrors({ soften: 2 }).join(), /soften is 1–1\.3/); assert.match(validateZooms({ render: {}, timeline: [{ type: "post", id: "p", zooms: [{ at: 1 }] }] }).join(), /zooms are a clip's/); }); @@ -45,11 +51,24 @@ test("resolved: refused past the limit by name; a soft limit lets it through wit const strict = resolveZooms(clip([{ at: 12, scale: 1.2 }]), base); assert.equal(strict.zooms.length, 0); assert.match(strict.errors[0], /c1: the zoom at 12 s \(×1\.2\) plays its source at 1\.2× its pixels; the limit here is ×1 .*soft limit/); - const soft = resolveZooms(clip([{ at: 12, scale: 1.2 }]), { ...base, maxScale: 1.3 }); + const soft = resolveZooms(clip([{ at: 12, scale: 1.2 }]), { ...base, soften: 1.3 }); assert.deepEqual(soft.errors, []); assert.match(soft.notes[0], /plays softer than its source: 1\.2× its pixels/); assert.equal(soft.zooms[0].at, 2, "on the segment's clock"); - assert.match(resolveZooms(clip([{ at: 12, scale: 1.4 }]), { ...base, maxScale: 1.3 }).errors[0], /limit here is ×1\.3 .*sharper source \(render\.tallWindows\)$/); + assert.match(resolveZooms(clip([{ at: 12, scale: 1.4 }]), { ...base, soften: 1.3 }).errors[0], /limit here is ×1\.3 .*sharper source \(render\.tallWindows\)$/); + // soften is NOT a cap on the total past the source's pixels: the reference is the coarser of those and the layout's + // resting picture. A full 9:16 crop of a 1080 window already plays at 1.78×: soften 1.3 lets it go 1.3 times that. + const full = pictureRegion(clipGeometry("full", {}, 1080, 1920), 1920, 1080); + assert.ok(full.rest > 1.7, `a full crop rests at ${full.rest}`); + assert.match(resolveZooms(clip([{ at: 12, scale: 1.2 }]), { ...base, region: full.region, rest: full.rest }).errors[0], /the limit here is ×1 /, "strict: no zoom"); + const fsoft = resolveZooms(clip([{ at: 12, scale: 1.3 }]), { ...base, region: full.region, rest: full.rest, soften: 1.3 }); + assert.deepEqual(fsoft.errors, []); + assert.match(fsoft.notes[0], /plays softer than its source: 2\.3\d?× its pixels/); + assert.match(resolveZooms(clip([{ at: 12, scale: 1.35 }]), { ...base, region: full.region, rest: full.rest, soften: 1.3 }).errors[0], /limit here is ×1\.3 /); + // A framed short (rests at 0.56): soften 1.3 lets the picture play 1.3× its source's pixels -- scale up to 2.31. + const fr0 = pictureRegion(clipGeometry("framed", {}, 1080, 1920), 1920, 1080); + assert.deepEqual(resolveZooms(clip([{ at: 12, scale: 2.3 }]), { ...base, region: fr0.region, rest: fr0.rest, soften: 1.3 }).errors, []); + assert.equal(resolveZooms(clip([{ at: 12, scale: 2.4 }]), { ...base, region: fr0.region, rest: fr0.rest, soften: 1.3 }).errors.length, 1); // A framed short: 1.5 is sharp, no note. const fr = pictureRegion(clipGeometry("framed", {}, 1080, 1920), 1920, 1080); const sharp = resolveZooms(clip([{ at: 12, scale: 1.5 }]), { ...base, region: fr.region, rest: fr.rest }); @@ -64,12 +83,46 @@ test("resolved: refused past the limit by name; a soft limit lets it through wit assert.deepEqual([out.zooms.length, /outside what plays/.test(out.notes[0])], [0, true]); }); -test("the filter: frames at the cut's rate, zoompan eased by smoothstep about each push's focus; none without zooms", () => { +test("the filter: frames at the cut's rate, a sub-pixel perspective eased by smoothstep about each push's focus, on only over the pushes; none without zooms", () => { assert.deepEqual(zoomFilters([], { srcW: 1920, srcH: 1080, fps: 30 }), []); const [fps, zp] = zoomFilters([{ at: 2, ramp: 0.4, hold: 1.5, scale: 1.5, focus: [0.75, 0.3] }], { srcW: 1920, srcH: 1080, fps: 30 }); assert.equal(fps, "fps=30"); - assert.match(zp, /^zoompan=z='\(1\+if\(between\(it,2\.0000,4\.3000\),0\.5000\*if\(lt\(it,2\.4000\),/); + assert.match(zp, /^perspective=x0='if\(between\(\(in\/30\),2\.0000,4\.3000\),0\.7500,0\.5\)\*W\*\(1-1\/\(1\+if\(between\(\(in\/30\),2\.0000,4\.3000\),0\.5000\*if\(lt\(\(in\/30\),2\.4000\),/); assert.match(zp, /\*\(3-2\*/, "smoothstep"); - assert.match(zp, /:x='if\(between\(it,2\.0000,4\.3000\),0\.7500,0\.5\)\*iw\*\(1-1\/zoom\)'/); - assert.match(zp, /:d=1:s=1920x1080:fps=30$/); + assert.match(zp, /:interpolation=cubic:sense=source:eval=frame:enable='between\(n\/30,2\.0000,4\.3000\)'$/); + assert.doesNotMatch(zp, /zoompan/, "zoompan rounds its crop to whole pixels: a slow ease wobbles"); +}); + +const haveFfmpeg = spawnSync("ffmpeg", ["-version"]).status === 0; +test("a slow push (1 s eases, 2 s held: 4 s) moves the picture monotonically -- no back-step in its offset; untouched outside it", { skip: !haveFfmpeg && "needs ffmpeg" }, () => { + // A black picture with a white right quarter: the edge's place on screen, to a fraction of a pixel, every frame. + const W = 640; + const H = 360; + const FPS = 30; + const z = { at: 0.5, ramp: 1, hold: 2, scale: 1.06, focus: [0.5, 0.5] }; + const chain = zoomFilters([z], { srcW: W, srcH: H, fps: FPS }).join(","); + const r = spawnSync("ffmpeg", ["-v", "error", "-f", "lavfi", "-i", `color=c=black:s=${W}x${H}:r=${FPS}:d=5,drawbox=x=480:y=0:w=160:h=${H}:c=white:t=fill,format=yuv420p`, "-vf", chain, "-f", "rawvideo", "-pix_fmt", "gray", "-"], { maxBuffer: 64 << 20 }); + assert.equal(r.status, 0, String(r.stderr)); + const n = r.stdout.length / (W * H); + assert.equal(n, 5 * FPS); + const edge = []; + for (let i = 0; i < n; i += 1) { + let sum = 0; + for (let y = 150; y < 210; y += 1) for (let x = 0; x < W; x += 1) sum += r.stdout[i * W * H + y * W + x]; + edge.push(W - sum / 255 / 60); + } + const t = (i) => i / FPS; + const steps = []; + for (let i = 1; i < n; i += 1) { + const d = edge[i] - edge[i - 1]; + if (t(i) > z.at && t(i) <= z.at + z.ramp && d < -0.02) steps.push(`in at ${t(i).toFixed(2)} s: ${d.toFixed(2)} px`); + if (t(i) > z.at + z.ramp + z.hold && t(i) <= zoomEnd(z) && d > 0.02) steps.push(`out at ${t(i).toFixed(2)} s: +${d.toFixed(2)} px`); + } + assert.deepEqual(steps, [], "a back-step in the ease"); + // Pushed in about the centre: the edge at 480 lands at (480 − 0.5·640·(1 − 1/1.06))·1.06 = 489.6 while held. + const held = edge[Math.round((z.at + z.ramp + 1) * FPS)]; + assert.ok(Math.abs(held - 489.6) < 0.3, `held at ${held}`); + // Outside the push the frame is the source's, untouched. + assert.equal(edge[3], 480); + assert.equal(edge[n - 3], 480); }); diff --git a/umtool/report-to-video/cold-open.test.mjs b/umtool/report-to-video/cold-open.test.mjs @@ -22,6 +22,15 @@ test("the rules: {from, to} inside the clip's cut, 1 to 4 s; a note outside 1.5 no({ from: 30, to: 36 }, /6 s: a cold open is 1–4 s/); no({ from: 38, to: 40 }, /outside the clip's cut \(12–38\)/); no({ from: 35, to: 37, play: true }, /play is not a key/); + // A gap inside it or across either edge: refused by the clip's name and the gap, never shortened. + const gapped = clip({ gaps: [{ from: 36, to: 36.5 }] }); + for (const v of [{ from: 35, to: 37.5 }, { from: 36.2, to: 38 }, { from: 34, to: 36.3 }]) { + assert.match(coldOpenErrors(v, "timeline w01.coldOpen", gapped).join(), /timeline w01\.coldOpen .* runs across w01's gap 36–36\.5 s/, JSON.stringify(v)); + } + assert.deepEqual(coldOpenErrors({ from: 34, to: 36 }, "w01.coldOpen", gapped), [], "up to the gap"); + assert.doesNotMatch(coldOpenErrors({ from: 35, to: 37.5 }, "timeline w01.coldOpen", gapped).join(), /~co/); + // The whole cut is not a cold open. + assert.match(coldOpenErrors({ from: 12, to: 15 }, "c", clip({ cutEnd: 15 })).join(), /is the whole cut/); assert.equal(coldOpenNote(clip({ coldOpen: { from: 35, to: 37.5 } }), "w01"), null); assert.match(coldOpenNote(clip({ coldOpen: { from: 34, to: 37.8 } }), "w01"), /3\.8 s; 1\.5–3 s reads best/); });