feat(foundry): stage a kit's level, because amp = gain^4
These are stems from a loud commercial master — MAREA's ALL DRUMS and KIT both peak at +0.2 dBFS — so a loop cut from them arrives at full scale. grade already calls that clipping, and SuperDirt cannot use it: amp = gain^4, so `# gain 1.2` is +7.6 dB and the orbit clips the moment you touch it. The house rule is peaks at -6 dBFS at the source and let the amplification happen downstream, so that is where kits land now. Two decisions inside kit_headroom_gain that matter more than the ceiling: NOT per file. One scalar for the whole kit. Normalising each file on its own would make a sparse hat loop exactly as loud as a full drum bus, throwing away the balance that two loops from one kit otherwise have for free — the reason to cut a kit from one track in the first place. NEVER boosts. A kit already below the ceiling is left exactly where it is. A quiet stem is quiet on purpose; lifting it amplifies its noise floor and discards real information about the arrangement. restage.py applies the same function to kits already on disk, so a kit restaged after the fact is bit-identical to one cut with it in place. Useful beyond this pack: hand-cut kits carry whatever level their source had, and there are 163 kits in Samples/. It also re-grades the manifest for anything it changed. Whoever moves the audio owns the record of it — every grade has a level term, so a stale manifest describes bytes that no longer exist, and kitgate compares the two precisely to catch that drift. Verified on the synthetic pack: clipping cleared, two drum loops A -> S, and the gate then caught the stale grades until restage started writing them back. 23 tests in the file.
Showing
tools/foundry/restage.py
0 → 100644
Please
register
or
sign in
to comment