commit 169074368f622da7433a3fce31d4eed91a1cd70a
parent 88868b68b022da9e741d10f2163a6fc62af1a365
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Sat, 10 Oct 2026 13:37:35 -0400
umtool: fit-hooks measures with the ceiling off and equal headroom
The hooks-only measurement render went through mk-mix-hooks' ceiling, so as soon
as the loudest hook passed LIMIT the whole render was scaled back and every
ratio stalled at what the ceiling allowed: targets 1.6 / 1.8 / 2.0 on the MK
song all reported 1.452 while the gains kept climbing, delivering +3 / +6 / +9 dB
instead. Both measurement renders now run with the ceiling off and turned down
by the same 0.25 (the wav is 16-bit, so a hot hook would otherwise clip and cap
the same way). A 1.60 target now converges to 1.600, spread 1.00x.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/umtool/song/fit-hooks.mjs b/umtool/song/fit-hooks.mjs
@@ -91,9 +91,22 @@ const rms = (x, a, b) => {
// mk-mix-hooks resolves EVERY path against SONG_DATA, so it must be handed the
// relative names it was given -- an absolute path comes back doubled
// (".../song/home/<user>/.../song/mk-overlays.json") and it dies on ENOENT.
+// The two sides are measured with the mixer's ceiling OFF and both renders turned down
+// by the same HEADROOM. With the ceiling on, the hooks-only render is scaled back as
+// soon as its loudest hook passes LIMIT, so every hook's ratio stalls at whatever the
+// ceiling allows (1.45 here) and each pass multiplies the gains up again chasing it:
+// targets of 1.6 / 1.8 / 2.0 all reported 1.452 and delivered +3 / +6 / +9 dB. Off
+// alone is not enough -- the wav is 16-bit and a hot hook would clip, which caps it
+// the same way -- hence the headroom, which scales both sides alike. The real mix
+// scales the WHOLE master at its ceiling, hooks and body together, so this ratio is
+// the one it delivers.
+const HEADROOM = 0.25;
const mix = (rel, env) => {
execFileSync("node", [path.join(DIR, "mk-mix-hooks.mjs"), SONG, OVL, rel],
- { env: { ...process.env, DRIVE, ...env }, stdio: ["ignore", "ignore", "inherit"] });
+ { env: { ...process.env, DRIVE, LIMIT: "1e9",
+ SONG_GAIN: String(HEADROOM * Number(process.env.SONG_GAIN ?? 1)),
+ HOOK_GAIN: String(HEADROOM * Number(process.env.HOOK_GAIN ?? 1)), ...env },
+ stdio: ["ignore", "ignore", "inherit"] });
return readWav(path.join(SONG_DATA, rel));
};