-
feat(foundry): rotate-to-downbeat export post-pass — loops start on the 1, not 'BCDA' · 0e69fa12
PLN's kit audition (logged 6cfc7af0): loops felt 'timed ok but cut BCDA/DABC — not at a good start'. Measured and confirmed — the PLP beat grid has no downbeat anchor, so candidate windows start on an arbitrary beat: superfreak other_skank's strongest onset sat on slot 2/8 (its first 30 ms −23 dB below its own peak 30 ms), bass_deep's on slot 4/16, drums_dub's on slot 1/16. Bar-exact and tempo-locked, but musically rotated. The key insight that makes the fix free: for a verified clean-seam, bar-exact loop, ROTATION IS SAFE BY CONSTRUCTION. Looped playback of a rotated loop is the same audio cycle — the old wrap junction plays interiorly, and the new wrap (the rotation point) joins samples that were contiguous in the source, i.e. perfectly continuous. Rotation only changes where the loop STARTS, never how it wraps. _rotate_to_downbeat(): score each beat slot by its circular low-band (<200 Hz, kick-weighted) attack — RMS just after minus just before — plus a small full-band term; roll the winning slot to position 0, zc-snapping the roll offset (B1) so a re-trigger starts at a crossing. Length untouched (np.roll) ⇒ the <1 ms bar-multiple guarantee (0759def5) holds through rotation. Wired into export_take (on by default, rotate=False opts out; chops bars=0 never rotate). Verify-rerank stays export-faithful: _true_seam now returns min(old-wrap seam, rotated-wrap seam) — both junctions of the shipped cycle are measured, so rotation can never hide a bad wrap by moving it inside the file. Tests: +3 (downbeat at slot 5 → rotated to 0; slot-0 no-op; rotating a continuous loop never breaks the seam). 85 passed.
PLN (Algolia) authored0e69fa12
| Name |
Last commit
|
Last update |
|---|---|---|
| .. | ||
| engine | Loading commit data... | |
| research | Loading commit data... | |
| tests | Loading commit data... | |
| ui | Loading commit data... | |
| .gitignore | Loading commit data... | |
| PHASE2_LOOPFINDER.md | Loading commit data... | |
| README.md | Loading commit data... | |
| TODO.md | Loading commit data... | |
| autotune.py | Loading commit data... | |
| demos.json | Loading commit data... | |
| foundry.py | Loading commit data... | |
| server.py | Loading commit data... |