fix: final-review findings (median pass tick, R11 secondary metrics, R12 chord duration, render version, dsp resample)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
2b7d5ffbeb
commit
b631bd2c7e
@@ -49,3 +49,27 @@ test("drums per class", () => {
|
||||
expect(s.drumsPerClass!.hihat.precision).toBe(0);
|
||||
expect(s.drumsPerClass!.tom.f1).toBeNull();
|
||||
});
|
||||
|
||||
test("gpPitch and barAgreement come from the output GP file (offset by grid.firstDownbeat)", async () => {
|
||||
const { songToGp, truthFromGp } = await import("../../src/score/gp.ts");
|
||||
const { generateSong } = await import("../../src/gen/generate.ts");
|
||||
const song = generateSong("t1a", 1);
|
||||
const gp = songToGp(song);
|
||||
const truthGp = truthFromGp(gp);
|
||||
const outNotes = truthGp.tracks.filter((t) => t.role === "guitar").flatMap((t) => t.notes);
|
||||
const mkOut = (firstDownbeat: number): PipelineOutput =>
|
||||
({ grid: { bpm: truthGp.bpm, firstDownbeat, beatsPerBar: 4 }, tracks: [{ name: "o", role: "guitar", notes: outNotes, scoreNotes: [] }] });
|
||||
const s = scoreSong(truthGp, mkOut(0), flags, gp);
|
||||
expect(s.gpPitch!.f1).toBe(1);
|
||||
expect(s.barAgreement).toEqual({ refBars: truthGp.bars, outBars: truthGp.bars, timeSigMatch: true });
|
||||
// GP time zero is the grid's first downbeat: a 0.25 s downbeat shifts the GP notes beyond the 50 ms tolerance
|
||||
expect(scoreSong(truthGp, mkOut(0.25), flags, gp).gpPitch!.f1!).toBeLessThan(0.5);
|
||||
// the truth shifted by the same downbeat matches again
|
||||
const shifted = { ...truthGp, tracks: truthGp.tracks.map((t) => ({ ...t, notes: t.notes.map((x) => ({ ...x, onset: x.onset + 0.25, offset: x.offset + 0.25 })) })) };
|
||||
expect(scoreSong(shifted, mkOut(0.25), flags, gp).gpPitch!.f1).toBe(1);
|
||||
// without an output GP both are null; a different bar count is reported
|
||||
const none = scoreSong(truthGp, mkOut(0), flags);
|
||||
expect(none.gpPitch).toBeNull();
|
||||
expect(none.barAgreement).toBeNull();
|
||||
expect(scoreSong({ ...truthGp, bars: truthGp.bars + 2 }, mkOut(0), flags, gp).barAgreement).toEqual({ refBars: truthGp.bars + 2, outBars: truthGp.bars, timeSigMatch: true });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user