feat(foundry): batch producer stem packs — and 96 kHz was breaking the finder
The Foundry could make stems (yt-dlp → demucs) but not eat stems somebody else already made. Fred again's dropbox is 9 tracks × 6-13 producer-labelled stems at 96 kHz/24-bit — better source material than demucs can produce, and completely outside what find_takes accepts: it keys stems by drums/bass/other/vocals, a dict that collides on KEYS1+KEYS2 and an export keep= filter that would have silently dropped every stem in the pack. engine/stempack.py is the missing batch driver (TODO #20), and building it turned up a real bug. MAREA ships its tempo in the filename (…123BPM…), so it is free ground truth. At native 96 kHz the finder returned 123/123/124/119/128.1/128.5 bpm and a 0.661 top score; resampled to 44.1 kHz first it returned 123.0-123.1 on every candidate and 0.859, in a third of the time. librosa's hop/window defaults are sample-rate-relative, so at 96 k every analysis frame spans half the musical time and beat tracking wanders. Rate is a correctness input, not a performance knob. engine/roles.py maps the pack's ~40 role tokens (39/40 hit directly) to a family, then verifies the label by measurement before anything trusts it — the house rule that a sound's role is never read off its name. The `hits` family (KICK, SNARE alone) is the one place the label carries information the cheap features cannot: an isolated kick and a full groove measure identically. engine/kitcheck.py audits what grade.py cannot see by construction. A four-bar loop whose last two bars are a fade grades S — silent-to-silent is a perfect seam and the length is still exact. So: per-bar RMS for dead bars, onset-envelope autocorrelation for whether a bar-aligned window is actually a repeating unit, and mel-fingerprint cross-correlation for near-duplicates, because a pack shipping ALL DRUMS + KIT + MAIN DRUM LOOP + DRUM BREAKS will otherwise ship one groove four times. --jobs fans out as subprocesses, not a ProcessPoolExecutor: the pool's forkserver is broken under this Python (BrokenProcessPool on a trivial task), and one process per track also means a track that blows up loses only itself. 15 new tests.
Showing
tools/foundry/engine/kitcheck.py
0 → 100644
tools/foundry/engine/roles.py
0 → 100644
This diff is collapsed.
Click to expand it.
tools/foundry/engine/stempack.py
0 → 100644
This diff is collapsed.
Click to expand it.
tools/foundry/tests/test_stempack.py
0 → 100644
Please
register
or
sign in
to comment