fix: pipeline fingering uses quantiser snap; more run tests
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
604d1a67af
commit
4c89f0d664
4 files changed
+91
-40
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { test, expect } from "bun:test";
|
||||
import { quantize } from "../../src/pipeline/quantize.ts";
|
||||
import { quantize, snapTicks } from "../../src/pipeline/quantize.ts";
|
||||
import type { TimedNote } from "../../src/core/types.ts";
|
||||
|
||||
const t = (onset: number, offset: number, pitch: number): TimedNote => ({ onset, offset, pitch });
|
||||
@@ -33,3 +33,10 @@ test("collapses exact duplicates, enforces min duration", () => {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
test("snapTicks matches quantize ticks, incl. chord clusters and adjacent repeated pitches", () => {
|
||||
// two same-pitch notes 20 ms apart merge; the next repeat is on the adjacent 16th (125 ms at 120 bpm)
|
||||
const notes = [t(0.1, 0.2, 60), t(0.12, 0.2, 60), t(0.225, 0.3, 60)];
|
||||
expect(snapTicks(notes, g)).toEqual([0, 0, 240]);
|
||||
expect(quantize(notes, g).map((n) => n.tick)).toEqual([0, 240]);
|
||||
});
|
||||
Reference in new issue
Block a user