Menu

When a Sustained MIDI Note Meets the Next Onset
📰

When a Sustained MIDI Note Meets the Next Onset

DEV Community: typescript·Giang Pham Truong·2 days ago
#sZCsPNJQ
#devtotypescript#devto#dev#midi#hand
Reading 0:00
15s threshold

A MIDI file can contain note events that overlap in time. A readable score needs a voice model, and that model makes choices about which overlaps it can represent. Pianory's MIDI-to-MusicXML converter currently builds one notation voice per hand. This article describes that constraint and a test that makes it visible.

Within a hand, notes sharing the same start are grouped into one chord. The converter sorts those starts, inserts a rest when the next start is later than the current cursor, and limits each group's written length to the next onset in that hand. Even when an input note sustains longer, the generated one-voice score can end it at that next onset. This keeps the measures filled consistently, but it does not preserve independently overlapping voices within the same hand.

The focused fixture is concrete. Three right-hand pitches, MIDI 60, 64 and 67, begin together at quarter 0 and last two quarters; the test expects C4, E4 and G4 in a chord.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.