commit f38de8ea7163d611bc7e0e07da5d5894043e6dde
parent b3a9aa8f5019f62f8eddcd021f5666a317c8e778
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Sun, 18 Oct 2026 01:58:46 -0400
Merge r33/wall-audio-length: the wall's audio exact to the sample (no frame lost under load)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/umtool/report-to-video/montage.mjs b/umtool/report-to-video/montage.mjs
@@ -1061,7 +1061,6 @@ export function wallComposeArgs({ tiles, plan, render, settings, first, last, en
const { fps } = render;
const bg = render.palette?.bg ?? "#000000";
const T = tiles.length;
- const total = exprNum(plan.seconds);
const beat = exprNum(plan.beat);
const parts = [];
const vs = [];
@@ -1101,7 +1100,7 @@ export function wallComposeArgs({ tiles, plan, render, settings, first, last, en
}));
parts.push(
`${as.join("")}amix=inputs=${as.length}:normalize=0:duration=longest,alimiter=limit=0.9,` +
- `apad=whole_dur=${total},atrim=end=${total},` +
+ wallAudioLength(plan, render) +
`afade=t=in:d=${DECLICK},afade=t=out:st=${exprNum(plan.seconds - DECLICK)}:d=${DECLICK}[a]`,
);
return [
@@ -1177,10 +1176,7 @@ function groupedWallComposeArgs({ tiles, plan, render, settings, first, last, en
}));
parts.push(
`${as.join("")}amix=inputs=${as.length}:normalize=0:duration=longest,alimiter=limit=0.9,` +
- // Re-stamped by sample count before the fades: amix's output clock can
- // run ahead of its samples when its inputs start late (an asplit feeding
- // a long adelay), and a fade timed on that clock silences the wall.
- `apad=whole_dur=${total},atrim=end=${total},asetpts=N/SR/TB,` +
+ wallAudioLength(plan, render) +
`afade=t=in:d=${DECLICK},afade=t=out:st=${exprNum(plan.seconds - DECLICK)}:d=${DECLICK}[a]`,
);
return [
@@ -1466,5 +1462,19 @@ export function templateOnset(feats, lags, { origin, window = 0.3, hop = 0.005,
return best ? { shift: (best.f - origin) * hop + 2 * hop, rise: best.rise } : null;
}
+/**
+ * The wall's sound, made exactly the wall's length, in SAMPLES. amix's output
+ * clock can run ahead of its samples when its inputs start late (an asplit
+ * feeding a long adelay): a pad or trim timed on that clock came out a frame
+ * short under load (1 of 3 parallel builds, 2026-10-18), and a fade timed on it
+ * silenced the grouped wall. So: one rate, re-stamped by sample count, then
+ * padded and trimmed to the sample.
+ */
+export function wallAudioLength(plan, render) {
+ const rate = Number(render.audioRate) > 0 ? Number(render.audioRate) : 48000;
+ const samples = Math.round(plan.seconds * rate);
+ return `aresample=${rate},asetpts=N/SR/TB,apad=whole_len=${samples},atrim=end_sample=${samples},asetpts=N/SR/TB,`;
+}
+
/** The wall's place in the cut, as an entry: what the chapters call it. */
export const WALL_ENTRY = Object.freeze({ type: "montage-wall", id: "montage-wall", title: "All together" });