A score can contain a note that lasts beyond the passage someone selected for practice. If a player schedules the full note, the sound can spill past the loop or a finite stop even when the UI says the passage ended.
Pianory resolves an inclusive measure selection into a score-time window and an exclusive event range. When scheduling an event, the player caps the note's end quarter at that window's end and limits the audio duration to the time remaining before the passage boundary. Its metronome scheduling uses the same endpoint, and a finite repetition ends there. The piano adapter receives that shortened duration when it starts the sample.
A focused mock-clock test puts a note authored for eight quarters inside a four-quarter finite passage. It checks that the scheduled note ends before the passage endpoint and that the final metronome click does not run beyond it. Tests also cover finite one-pass and two-pass endings. The focused player suite passed locally: 20 tests.
The useful contract is that a practice range controls the audio schedule, not just the playhead display. This test verifies planned durations with a mocked audio adapter and clock; it does not prove acoustic output, sample loading, timing on every device, or browser performance. I make Pianory, the piano-learning app behind this example. AI helped draft this article, and I checked the claims against the source and focused tests.
Top comments (0)