Archilyzer · Source

archilyzer

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

commit eec16168b59dd8d58befc9b4ddf35303c48b5f24
parent 4bc8926a7a5c66172ddaa1102720e874fbe9b599
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Sat, 14 Nov 2026 15:41:55 -0500

um song, reuse pass: a gap over 30 s no longer refuses every um, the output may not overwrite the plan it is made from, and an empty or negative setting is refused

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

Diffstat:
Mumtool/song/reuse-pass.mjs | 10+++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/umtool/song/reuse-pass.mjs b/umtool/song/reuse-pass.mjs @@ -47,7 +47,10 @@ import { midiOf } from "./pitch.mjs"; const [IN, OUT] = process.argv.slice(2); if (!IN || !OUT) { console.error("usage: node reuse-pass.mjs <plan-in.json> <plan-out.json>"); process.exit(2); } -const num = (name, dflt) => { const v = Number(process.env[name] ?? dflt); if (!Number.isFinite(v) && v !== Infinity) throw new Error(`${name} is not a number`); return v; }; +// the pass refuses a plan it has been over, so writing over the plan it reads would leave nothing to run it on again +if (path.resolve(IN) === path.resolve(OUT)) { console.error("the output would overwrite the plan it is made from: give another path"); process.exit(2); } +// an empty value is not a setting (Number("") is 0, which would quietly turn the pass off), and none of these may be negative +const num = (name, dflt) => { const raw = process.env[name]; if (raw !== undefined && raw.trim() === "") throw new Error(`${name} is set but empty`); const v = Number(raw ?? dflt); if (Number.isNaN(v) || v < 0) throw new Error(`${name} is not a number >= 0`); return v; }; const GAP = num("REUSE_GAP", 10), TOL = num("RAW_TOL", 0.15), MIN_FILL = num("MIN_FILL", 0.85); const MAX_USES = num("MAX_USES", Infinity); const REUSE = process.env.REUSE !== "0", DRY = process.env.DRY === "1"; @@ -55,8 +58,9 @@ const SR = 48000; // how far a clip's whole-window pitch may sit from a note before it is not worth // measuring against that note's own length const PRE = num("PRE", 1.0); -// past this an um counts as simply "not recently heard" -const FAR = 30; +// past this an um counts as simply "not recently heard" -- never below the gap itself, or a gap +// over 30 s would refuse every um, used or not +const FAR = Math.max(30, GAP); const plan = JSON.parse(readFileSync(IN, "utf8")); // A plan this pass has already been over cannot be passed again: the clips its notes