feat(align): automatic alignment and fit quality

Coarse (10 Hz) DTW per stretch between manual anchors, refined at 50 Hz in a
band that widens 0.5 -> 1 -> 2 s on unreachable end cells (coarse path as last
resort); one auto anchor per bar from median offsets of diagonal path steps.
Fit quality from raw-audio onset peaks vs warped scored-role MIDI onsets
(+-70 ms, 30 s windows, flagged on rate < 0.5 or median > 60 ms).
trackKeys moves to src/align/roles.ts (pure) and is re-exported by manifest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas WintherandClaude Opus 5.5 committed 2026-10-30 06:52:10 +01:00
1 parent 41e38cb03f
commit 8cad85e103
6 files changed
+497 -11

No files matched your search

+11
View File
@@ -15,3 +15,14 @@ export function guessRole(t: RefTrack): Role | null {
if ((p >= 0 && p <= 7) || (p >= 16 && p <= 23) || (p >= 88 && p <= 95)) return "keys";
return null;
}
// Role-map key for a track: its name, or "track N" when unnamed; disambiguated on collision.
export function trackKeys(tracks: { index: number; name: string }[]): string[] {
const used = new Set<string>();
return tracks.map((t) => {
let k = t.name || `track ${t.index}`;
if (used.has(k)) k = `${k} #${t.index}`;
used.add(k);
return k;
});
}