Music Software Development

MIDI stuck note fixer

A stuck (or hanging) note keeps sounding after it should have stopped. In a MIDI file the cause is almost always in the data: a Note Off that never comes, a key struck twice before it is released, or a sustain pedal left down. This tool finds each one, shows you where it is, and repairs it with the smallest change that makes every note end. Everything runs on your device; the file is never uploaded.

Stuck note fixer

Or drag a file onto this box, or

Choose a MIDI file to check for stuck notes.

Why notes get stuck in a MIDI file

MIDI does not store notes as “C4 for one beat”. It stores two separate events: a Note On when the key goes down and a Note Off when it comes up, each with a channel and a key number. A synthesizer starts a voice at the Note On and keeps it going until it receives a matching Note Off: same channel, same key. If that release never arrives, nothing tells the synth to stop. (A Note On with velocity 0 is also a release; files use it to save space with running status.)

The four causes the fixer repairs
ProblemWhat the file containsHow it is repaired
Missing Note OffA Note On with no later release for that key and channel in the same track. Common after an export was interrupted, a recording stopped mid-note, or a hand-edited file lost a line.A Note Off is added after the length you choose (one beat by default), but never past the end of the file.
Repeated Note OnThe same key starts again while it is still sounding: On, On, Off, Off. Synths disagree about this. Some start a second voice and the first release stops only one, so one voice keeps ringing.The first note is ended exactly where the key is struck again. If the file only had one release for the two notes (On, On, Off), that release is kept for the second note.
Sustain pedal left downController 64 is set to 64 or more and never set back below 64. Every note played while it is down keeps sounding, even though each note has its Note Off.A pedal release (controller 64 = 0) is added where the last note on that channel ends.
Zero-length noteThe Note Off is on the same tick as its Note On. If a player handles the release first, the note starts after its own release and never ends.The note is lengthened to a 1/64 note. If the same key starts again on that same tick, the empty note is removed.

How Note Offs are matched to notes

When a key is struck several times before any release, the fixer, like most sequencers and the MIDI file analyzer, gives each release to the earliest note still sounding on that key (first in, first out). So in On, On, Off, Off, the first release ends the first note. Notes are matched within one track, because a format 1 file keeps each part in its own track. If two tracks play the same key on the same channel at once, the analyzer still flags it after the repair. The fix there is to give one part its own channel, which changes the arrangement and is left to you.

What the repair never changes

Choosing a length for missing Note Offs

A missing release means the file never said how long the note was meant to be, so any length is a guess. One beat suits most melodies and chords. A sixteenth or eighth note suits drums and short percussive parts, where the sound decays by itself anyway. “The end of the file” keeps a held pad or organ chord sounding to the end, which is usually what the part intended when the last release was lost. After repairing, listen in the MIDI player and adjust if a note now ends too early.

If notes hang while playing live, not in a file

Notes that stick only on a keyboard, controller or DAW track are usually a lost message on a cable, a MIDI loop, or a pedal with reversed polarity, not a broken file. Send a “panic” (sustain off, All Sound Off and All Notes Off on all 16 channels). The MIDI troubleshooting guide walks through the checks and has the exact bytes.

Check the result

The report above lists every change with its position, and re-runs the file-wide check from the analyzer on the repaired file. To see every note side by side, open the original and the repaired file in MIDI compare. To tidy the file further, the MIDI cleanup tool can remove drums, even out velocities and quantize.