Finding overlapping MIDI notes

I’ve been using Beeano Midi Player to visualise MIDI tracks on a piano roll for inclusion in piano tutorial videos. As the software doesn’t support the sustain pedal for indicating the duration of a held note, I’ve been extending a note in the MIDI track to occupy the entire held duration, and at the same time, using quantisation. Beeano is a bit temperamental processing overly quantised MIDI tracks, where two held notes of the same pitch that are snug against each other are considered overlapping. Beeano plays the first note, but cuts out for the second overlapping note in the visualisation.

MIDI doesn’t have the concept of a note duration; instead a held note is represented by a MIDI on event at a pitch and a MIDI off event at the same pitch to represent a held note. In addition to the MIDI off event, the MIDI spec also indicates that a zero velocity MIDI note on can also represent the end of a note.

A prevention method for these overlapping notes is to not overly quantise notes such that note ends finish at the same time as the next note (at the same pitch) starts. However, if that is required, instead of checking each note, a quick remediation method is to select all notes in the track using a sequencer, and decrease the length a few ticks.

I found this last step helped immensely with my tracks, but I was still finding the occasional overlapping note when running through Beeano. This could be due to the recording device, but I’m not sure.

To detect these overlapping notes, I wrote a quick Python script that would report on these overlaps. This helps narrow the search down trememdously.