feat(align): SMF parser, role guess, reference manifest
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
67168e6103
commit
e910036e67
8 files changed
+414
-1
No files matched your search
@@ -0,0 +1,17 @@
|
||||
import type { Role } from "../core/types.ts";
|
||||
import type { RefTrack } from "./smf.ts";
|
||||
|
||||
// Best-effort role for a reference MIDI track; null = unmapped (excluded from scoring until the user maps it).
|
||||
export function guessRole(t: RefTrack): Role | null {
|
||||
if (t.isDrums) return "drums";
|
||||
const n = t.name.trim().toLowerCase();
|
||||
if (/vocal|voice|vox|sing/.test(n)) return "vocals";
|
||||
if (/bass/.test(n)) return "bass";
|
||||
if (/guitar|delay/.test(n)) return "guitar";
|
||||
if (/piano|key|synth|organ/.test(n)) return "keys";
|
||||
const p = t.program;
|
||||
if (p >= 32 && p <= 39) return "bass";
|
||||
if (p >= 24 && p <= 31) return "guitar";
|
||||
if ((p >= 0 && p <= 7) || (p >= 16 && p <= 23) || (p >= 88 && p <= 95)) return "keys";
|
||||
return null;
|
||||
}
|
||||
Reference in new issue
Block a user