Archilyzer · Source

archilyzer

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

commit f910193b07684200e519336cf9e760357012d5cc
parent 2d619080c27a9a340d40c1ecf7f1d4a3dd9159aa
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Sat, 24 Oct 2026 05:45:53 -0400

Play the cut and the phone walk: Back to the cut by source second; the render's edges on the edge strip

The walk's `?clip=&at=` return is placed by clip id, then -- once the
render's edges are in -- by the source second the offset showed, and placed
again by it as the plan is re-timed (the composition, the edges arriving);
data-play-source stays the manifest's play window (what the bench edits),
data-play-span the render's cut. RenderGhosts splits into useRenderEdges
(measured once per saved extent, snapped per drag) and the desk's ghosts;
the phone's EdgeStrip draws the same edges as a faint line on its waveform
and the offset under each edge.

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

Diffstat:
Mumtool/components/projects/ClipBench.tsx | 8++++++--
Mumtool/components/projects/bench/EdgeStrip.tsx | 21+++++++++++++++++++++
Mumtool/components/projects/bench/RenderGhosts.tsx | 67++++++++++++++++++++++++++++++++++++++++---------------------------
Mumtool/docs/knobs.md | 6+++++-
Mumtool/e2e/play-engine.spec.ts | 9+++++++++
5 files changed, 81 insertions(+), 30 deletions(-)

diff --git a/umtool/components/projects/ClipBench.tsx b/umtool/components/projects/ClipBench.tsx @@ -18,7 +18,7 @@ import { cn } from "@/lib/utils"; import { BenchBody, VerdictBar } from "./bench/BenchShell"; import CopyCitation from "./bench/CopyCitation"; import EdgeStrip from "./bench/EdgeStrip"; -import RenderGhosts from "./bench/RenderGhosts"; +import RenderGhosts, { useRenderEdges } from "./bench/RenderGhosts"; // The renderer's own line, imported rather than re-written. A preview that // disagrees with the header by a character is worth less than no preview: you // would only find out twenty minutes into a build. @@ -466,6 +466,9 @@ export default function ClipBench({ data }: { data: ClipBenchData }) { const [proposed, setProposed] = useState(data.proposed); const [view, setView] = useState(data.view); const [sel, setSel] = useState({ from: data.clip.start, to: data.clip.end }); + // Where the render will actually cut the drafted selection (bench/RenderGhosts.tsx): the + // desk's waveform and the phone's edge strip both draw it. + const renderEdges = useRenderEdges(data.project, clip, sel); // The mute mark as drafted. Like the edges it is unsaved until `save window` // or `y`, and it is what the bench's own playback mutes at -- so a mark is // heard before it is written. @@ -2580,6 +2583,7 @@ export default function ClipBench({ data }: { data: ClipBenchData }) { busy={!!busy} fmt={hms} onSel={onSel} + render={renderEdges} onFetch={(edge, t) => void fetchMore( edge === "end" @@ -3186,7 +3190,7 @@ export default function ClipBench({ data }: { data: ClipBenchData }) { </> )} {/* Where the render will actually cut: each edge snapped to its silence, faint. */} - <RenderGhosts project={data.project} clip={clip} sel={sel} view={view} /> + <RenderGhosts edges={renderEdges} view={view} /> {/* Armed: the next click places the mark rather than an edge. */} {mutePick && ( <div diff --git a/umtool/components/projects/bench/EdgeStrip.tsx b/umtool/components/projects/bench/EdgeStrip.tsx @@ -4,6 +4,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import type { Peaks } from "@/components/Waveform"; import { usePalette } from "@/components/ui/use-palette"; import { cn } from "@/lib/utils"; +import { ghostLabel, type RenderEdges } from "./RenderGhosts"; import { SNAP_RADIUS, sentenceBoundaries, @@ -57,6 +58,7 @@ export default function EdgeStrip({ fmt, onSel, onFetch, + render = null, className, }: { /** The cached window, which the waveform spans. */ @@ -73,6 +75,8 @@ export default function EdgeStrip({ onSel: (next: { from: number; to: number }, dragging: boolean, edge: Edge) => void; /** Fetch far enough to put `t` inside the cache, on `edge`'s side. */ onFetch: (edge: Edge, t: number) => void; + /** Where the render will cut (RenderGhosts.tsx useRenderEdges): a faint line on the waveform, its offset under each edge. */ + render?: RenderEdges; className?: string; }) { const pal = usePalette(); @@ -300,6 +304,18 @@ export default function EdgeStrip({ {playhead != null && inView(playhead) && ( <div aria-hidden className="pointer-events-none absolute inset-y-0 w-px bg-text" style={{ left: pct(playhead) }} /> )} + {render && + (["start", "end"] as const).map((edge) => + inView(render[edge].at) ? ( + <div + key={`render-${edge}`} + aria-hidden + data-strip-render-edge={edge} + className="pointer-events-none absolute inset-y-0 border-l border-dotted border-[color-mix(in_srgb,var(--color-text)_45%,transparent)]" + style={{ left: pct(render[edge].at) }} + /> + ) : null, + )} </div> {(["start", "end"] as const).map((edge) => { const t = edge === "start" ? sel.from : sel.to; @@ -350,6 +366,11 @@ export default function EdgeStrip({ <span className="text-center text-[12px] text-muted-2"> {edge} <span className="block font-mono text-[11.5px] text-text-2">{fmt(edge === "start" ? sel.from : sel.to)}</span> + {render && ( + <span className="block font-mono text-[10.5px] text-muted" data-strip-render-offset={render[edge].offset}> + {ghostLabel(render[edge])} + </span> + )} </span> <button type="button" data-edge-step={`${edge}-on`} disabled={busy || !on} onClick={() => step(edge, 1)} className={stepBtn}> sentence › diff --git a/umtool/components/projects/bench/RenderGhosts.tsx b/umtool/components/projects/bench/RenderGhosts.tsx @@ -34,17 +34,25 @@ function playWindowOf(sel: { from: number; to: number }, cut: { cutStart: number }; } -export default function RenderGhosts({ - project, - clip, - sel, - view, -}: { - project: string; - clip: { id: string; start: number; end: number; cutStart: number | null; cutEnd: number | null }; - sel: { from: number; to: number }; - view: { from: number; to: number }; -}) { +/** One edge as the render will cut it: where (source s), how far from the edge drawn, and whether a silence moved it. */ +export type GhostEdge = { at: number; offset: number; snapped: boolean }; +export type RenderEdges = { start: GhostEdge; end: GhostEdge } | null; + +/** "render: +0.52 s" (or "render: here"): a ghost's words. */ +export const ghostLabel = (g: GhostEdge) => + Math.abs(g.offset) < 0.005 ? "render: here" : `render: ${g.offset > 0 ? "+" : "−"}${Math.abs(g.offset).toFixed(2)} s`; + +/** + * Where the render will cut this clip's drafted selection: the silences + * measured once per saved extent (the cut-points route), snapped here on + * every drag. null until measured, or when the route cannot say (no source on + * disk, a montage's phrase cut). + */ +export function useRenderEdges( + project: string, + clip: { id: string; start: number; end: number; cutStart: number | null; cutEnd: number | null }, + sel: { from: number; to: number }, +): RenderEdges { const [got, setGot] = useState<{ key: string; row: Row | null; knobs: Got["knobs"]; leadIn: number } | null>(null); // Measured again when what was SAVED moves (the extent picks the file and the span). const key = `${project}|${clip.id}|${clip.start}|${clip.end}|${clip.cutStart}|${clip.cutEnd}`; @@ -62,39 +70,44 @@ export default function RenderGhosts({ }; }, [key, project, clip.id]); const row = got?.row; - if (!row || !row.silences || row.fetchStart == null || row.montage) return null; - const pw = playWindowOf(sel, clip, got!.leadIn); + if (!got || !row || !row.silences || row.fetchStart == null || row.montage) return null; + const pw = playWindowOf(sel, clip, got.leadIn); const render = { - snapWindow: got!.knobs.snapWindow ?? undefined, - snapLead: got!.knobs.snapLead ?? undefined, - snapTail: got!.knobs.snapTail ?? undefined, + snapWindow: got.knobs.snapWindow ?? undefined, + snapLead: got.knobs.snapLead ?? undefined, + snapTail: got.knobs.snapTail ?? undefined, }; const cut = renderCut({ sil: row.silences, fetchStart: row.fetchStart, playFrom: pw.from, playTo: pw.to, render }); + return { + start: { at: cut.start, offset: Number((cut.start - pw.from).toFixed(3)), snapped: cut.snapped.start }, + end: { at: cut.end, offset: Number((cut.end - pw.to).toFixed(3)), snapped: cut.snapped.end }, + }; +} + +/** The ghosts over the desk's waveform: a faint line at each edge the render cuts at, with its offset. */ +export default function RenderGhosts({ edges, view }: { edges: RenderEdges; view: { from: number; to: number } }) { + if (!edges) return null; const span = Math.max(1e-6, view.to - view.from); const pct = (t: number) => `${((t - view.from) / span) * 100}%`; - const edges = [ - { edge: "start", at: cut.start, from: pw.from, snapped: cut.snapped.start }, - { edge: "end", at: cut.end, from: pw.to, snapped: cut.snapped.end }, - ] as const; return ( <> - {edges.map((g) => { + {(["start", "end"] as const).map((edge) => { + const g = edges[edge]; if (g.at < view.from || g.at > view.to) return null; - const d = g.at - g.from; - const label = Math.abs(d) < 0.005 ? "render: here" : `render: ${d > 0 ? "+" : "−"}${Math.abs(d).toFixed(2)} s`; + const label = ghostLabel(g); return ( <div - key={g.edge} - data-render-edge={g.edge} + key={edge} + data-render-edge={edge} data-render-at={g.at} - data-render-offset={Number(d.toFixed(3))} + data-render-offset={g.offset} data-render-snapped={g.snapped ? "" : undefined} title={`the render cuts here (${g.snapped ? "snapped to a silence" : "no silence near: as drawn"}); ${label}`} className="pointer-events-none absolute top-0 h-full border-l border-dotted border-[color-mix(in_srgb,var(--color-text)_45%,transparent)]" style={{ left: pct(g.at) }} > <span - className={`absolute ${g.edge === "start" ? "right-full mr-0.5" : "left-full ml-0.5"} top-3 whitespace-nowrap rounded bg-[color-mix(in_srgb,var(--color-panel-2)_80%,transparent)] px-1 font-mono text-[9px] leading-tight text-[var(--color-dim)]`} + className={`absolute ${edge === "start" ? "right-full mr-0.5" : "left-full ml-0.5"} top-3 whitespace-nowrap rounded bg-[color-mix(in_srgb,var(--color-panel-2)_80%,transparent)] px-1 font-mono text-[9px] leading-tight text-[var(--color-dim)]`} > {label} </span> diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md @@ -253,7 +253,11 @@ What it still does not do (the line under the picture says so, with which sound cards, teasers and images are **placeholders** with their heading for their seconds; a push, a wipe or a whip is drawn as a dissolve; the limiter after the loudness gain is not applied; a montage's phrase cuts are snapped as plain cuts. A clip whose source window is not on disk is a named placeholder that plays on (silent) — fetch it from the -Cut tab. **Reload the cut** reads an edit made elsewhere, and the edges are measured again for what moved. +Cut tab. **Reload the cut** reads an edit made elsewhere, and the edges are measured again for what moved. **Edit this clip** (E) and the bench's **Back to the cut** come back +to the same clip by its id and then by the SOURCE second you left (`?clip=&at=`, the offset turned into a source +second once the render's edges are in), so an edit that moves the clip's start does not move you off the word. The +bench draws the render's cut over its waveform and, on a phone, on the edge strip (a faint line, and its offset under +each edge). The notes are the project's `notes.json` ([notes.md](notes.md)): `umtool notes <p>` prints each with its cut second, its clip and source, and — for a take — that its patch is the file to edit. **Send to the assistant** is the video diff --git a/umtool/e2e/play-engine.spec.ts b/umtool/e2e/play-engine.spec.ts @@ -136,4 +136,13 @@ test("the bench draws where the render will cut; an edge moved there is what Pla await page.goto(urls.playHref(PROJECT)); await expect(root(page)).toHaveAttribute("data-play-edges", "render", { timeout: 30_000 }); await expect(root(page)).toHaveAttribute("data-play-span", "1.2-3.082"); + // (The manifest's play window, what the bench edits, beside it.) + await expect(root(page)).toHaveAttribute("data-play-source", "1.2-3"); + + // On a phone the edge strip carries the same: a faint line on its waveform, the offset under each edge. + await page.setViewportSize({ width: 390, height: 844 }); + await page.goto(urls.clipBenchHref(PROJECT, "c01")); + await expect(page.locator('[data-edge-row="end"] [data-strip-render-offset]')).toHaveText("render: +0.08 s", { timeout: 30_000 }); + await expect(page.locator('[data-edge-row="start"] [data-strip-render-offset]')).toHaveText("render: here"); + await expect(page.locator('[data-strip-render-edge="end"]')).toHaveCount(1); });