AudioToMidiNow Use the MP3 to MIDI converter

MIDI KEYS AND PEDAL STATE

MIDI Sustain Pedal: Why Do Notes Outlast Note-Off?

Note-off marks key release; it does not necessarily end a note held by the sustain pedal. In a simple MIDI 1.0 on/off sustain model, CC64 keeps a released note held until a pedal-off message arrives on its channel. Check the note events and pedal events separately before stretching the notes or deleting their ends. The sound can also have a release tail after the hold ends.

A short block in the piano roll and a longer sound are not automatically a transcription error. After making an audio-to-MIDI draft, first establish what the file actually contains: a long note, short notes plus controller data, or short notes whose instrument rings out. This page provides five small MIDI files that separate key release from the point at which a binary sustain model permits release. No audio-to-MIDI model or piano plugin was run for these examples.

The controller number and its value are different numbers

The MIDI Association's MIDI 1.0 control-change table assigns controller 64 to damper pedal on/off. For that binary interpretation, data values 0–63 are off and 64–127 are on. Thus CC64 with value 63 and CC64 with value 64 differ by only one unit but sit on opposite sides of the switch boundary.

In hexadecimal, B0 40 7F means control change on channel 1, controller 64, value 127. B0 40 00 is pedal off on channel 1. Changing the first byte to B1 addresses channel 2; it does not turn off channel 1's pedal state in this model. A value of 127 is not a note length or a number of seconds.

Five files, three different questions

Each fixture contains one note, MIDI number 60, played at velocity 80 at tick 0. The files use 480 ticks per quarter note and 120 BPM, so this constructed timeline has 960 ticks per second. The first four files send note-off at tick 240. The fifth is a control: the key stays down until tick 720.

Our parser maintains two separate pieces of information: whether the key is down, and whether its release is deferred by the channel's pedal. We call the resulting moment release eligibility. It is a model event, not a measurement of silence, acoustic decay, or a synthesizer's envelope.

Key release versus modeled release eligibility
FixtureKey note-offPedal sequenceRelease eligible
Value 63240 ticks / 0.25 sCh1 value 63, then 0 at 480240 ticks / 0.25 s
Value 64240 ticks / 0.25 sCh1 value 64, then 0 at 480480 ticks / 0.50 s
Value 127240 ticks / 0.25 sCh1 value 127, then 0 at 480480 ticks / 0.50 s
Wrong channel up240 ticks / 0.25 sCh1 on; Ch2 off at 480; Ch1 off at 720720 ticks / 0.75 s
Key still held720 ticks / 0.75 sCh1 on, then off at 480720 ticks / 0.75 s

1. Does this value engage a binary hold?

The first three files have identical note-on and note-off timing. Value 63 leaves the modeled pedal off, so key release at tick 240 permits release immediately. Values 64 and 127 both engage the binary hold; the parser records key-up at 240 but defers release until the channel-1 pedal-off at 480. Increasing 64 to 127 does not create a longer hold in this deliberately binary model.

2. Did the release reach the note's channel?

The fourth file contains an off message at tick 480, but it belongs to channel 2. Channel 1 remains on. Only its own off message at tick 720 clears the deferred note. Searching a merged event list for any CC64 value 0 would therefore be insufficient: inspect the channel as well as the time and value.

3. Is the key itself still down?

In the fifth file, the pedal rises at tick 480 while the note's key is still down. There is no deferred key release to flush at that point. The later note-off at 720 permits release. Pedal-up is not modeled as an instruction to stop every pressed key. This control also explains why the same final release time of 720 does not prove the same cause in the fourth and fifth files.

Download the event evidence

Save the script in an empty directory and run python experiment.py with Python 3. It uses only the standard library. It writes five Format 0 MIDI files, then reads their bytes to produce the JSON and CSV. Existing files with those names are replaced. Assertions check release eligibility at ticks 240, 480, 480, 720, and 720, and verify that every fixture eventually releases its only note. All channel state begins with pedal off.

Use the trace to follow the transition at note-off: key60Down becomes false; key60Deferred can remain true while the pedal is on. When the relevant pedal turns off, that deferred state clears. No audio samples are generated, so these numbers are not measured sound durations.

A practical check on a confusing MIDI draft

  1. Keep a copy before editing. Compare the raw draft with its original recording. Do not lengthen every note simply because the instrument has a long tail.
  2. Inspect the note and CC64 lanes. Check whether the file actually includes pedal messages. An audio transcription should not be assumed to recover a pianist's physical pedal movements.
  3. Check values, channels and ordering. Look for pedal-off after the relevant key release, on the same receiving channel. A host may also generate, chase, or filter controller data outside the file.
  4. Test with a receiving instrument that documents sustain support. Compare the same passage with and without its CC64 events on a duplicate. A patch that ignores sustain cannot validate pedal behavior.
  5. Separate holding from decay. If the model permits release but you still hear a tail, inspect the patch's release behavior and effects. If the issue is wrong pitch or onset timing, address that separately rather than using pedal edits as a substitute.

Changing note ends is a different operation from retaining pedal data. The note-end quantization examples illustrate how gate durations can change; they do not establish an instrument's audible decay. Likewise, retained pitch-bend state concerns tuning rather than deferred note release. For a file that fails to open, start with the MIDI file checks.

Where this on/off model stops

Half-pedaling and piano-specific response can be more detailed. The MIDI Association's Piano Profile announcement describes continuous pedal behavior, deferred note-offs and release-stage details. Our threshold comparison does not implement that profile or predict a continuous pedal's sound.

The fixtures also exclude repeated same-pitch notes, sostenuto, voice stealing, release envelopes, resonance, effects, controller polarity, All Notes Off, and host reset behavior. They establish exact transitions under the written model, not compatibility across products or a universal fix for hanging notes. They do not show that a recording's long tail came from a pedal.

Experiment generated and checked October 24, 2026. Constructed MIDI 1.0 event-state examples; no hardware, DAW playback or transcription-accuracy test.