-
feat(foundry): length-preserving zero-crossing snap — exported loops are exact bar multiples · 0759def5
The B1 zc-snap moved each loop edge independently (±10ms tolerance), so exported loop DURATIONS drifted off the bar grid: measured −4.2ms on a 4-bar (superfreak bass) and −11.4ms on 2-bar loops (hammer kit, both edges snapped inward). loopAt absorbs the drift, but the kit contract we want is stronger: every exported loop's duration == bars × bar_len. Fix — _snap_length_preserving(): hold the exact bar-multiple sample count RIGID (bar_len_samples from the take's grid BPM) and slide the WHOLE window by a single common offset δ ∈ ±ZC_TOL_MS, picking the δ that minimizes combined edge amplitude |y[start]|+|y[end]| (tie-break: smallest |δ|). Both edges move together ⇒ duration is preserved by construction; guarantee |exported_dur − bars·bar_len| < 1ms (measured <0.02ms on real stems). Chops (bars=0) keep the per-edge snap. _snapped_window/_true_seam (verify-rerank, 791a0d78) now mirror the same scheme so the finder still measures the exact window export writes — export-faithfulness is preserved through the change. kit_multiples_check() makes the guarantee explicit per forge: after export, each file's duration-in-bars at the shared grid BPM is compared to the nearest integer multiple; >0.5% deviation warns with numbers. export_take_report() bundles export + check; the server /api/export now returns the multiples block. Spot-check on real stems (old per-edge vs new length-preserving snap, top-5 finder candidates re-graded on the exact export window): superfreak drums: dev +0.4…+3.6ms → ≤0.01ms; grades C→S, A→A, S→A, S→S superfreak bass: dev −1.1…+3.7ms → ≤0.01ms; grades A→S, B→C, S→B, A→A hammer drums: dev −1.8…+1.9ms → ≤0.01ms; all S stay S hammer bass: dev −2.9…+6.9ms → ≤0.01ms; C→B, A→S, D→C, B→C Net: duration guarantee achieved; grade moves are the rigid-length window exposing true seams (some old windows only looked seamless because per-edge snap trimmed the tail). No systematic regression; existing superfreak/hammer kit exports untouched (validated, in use). Tests: +4 (snap length invariance, bar_len_samples, end-to-end exported- duration-is-exact-bar-multiple on a synthetic stem, multiples-check flags off-grid). 81 passed.
PLN (Algolia) authored0759def5
| Name |
Last commit
|
Last update |
|---|---|---|
| .. | ||
| __init__.py | Loading commit data... | |
| autotune.py | Loading commit data... | |
| correlate.py | Loading commit data... | |
| demos.py | Loading commit data... | |
| fetch.py | Loading commit data... | |
| grade.py | Loading commit data... | |
| loops.py | Loading commit data... | |
| model.py | Loading commit data... | |
| naming.py | Loading commit data... | |
| publish.py | Loading commit data... | |
| separate.py | Loading commit data... | |
| vox.py | Loading commit data... |