MP3 to MIDI Sustain Pedal: What Control Change 64 Stores

The sustain pedal is not stored with the notes. A converter that claims to capture it has to write Control Change number 64, and that message carries no note number, so one message holds or releases every sounding note on its channel. Its 128 values are read as a switch.

The pedal, answered

  • The pedal is not a note. It is Control Change number 64. Unlike a note it carries no key number, so one message holds every sounding note on that channel.
  • It has one bit of range, not 128 steps. The controller accepts values 0 to 127, but the specification reads it as a switch: below 63 is off, above 64 is on.
  • Two required messages can clear it. Reset All Controllers and All notes off share the pedal's status byte, and Level 1 requires both.
  • Counting notes will not find it. A file with no pedal data looks like a richly pedalled one if you only read the notes.

A control change is not addressed to a note

Every note message carries two addresses, a channel and a key number, which is why 16 channels times 128 keys gives 2,048 places a note can sit. A Control Change carries the channel and nothing else. Its format is 1011nnnn, one controller number and one value, and the specification names pedals and levers as the kind of device that sends it. There is no key field to put a note in.

The whole pedal range is one bit

The controller table lists number 64 as the damper pedal, on or off, and writes the threshold as below 63 is off and above 64 is on. That convention takes the 128 values the controller accepts and reads them as two states: 0 through 63 as off, 64 through 127 as on, sixty-four values on each side. Values 63 and 64 are adjacent and opposite. A converter that writes 100 for a half-pedal has written a value every device reads as on.

Six switches share one threshold

Numbers 64 through 69 in that table are all switches with the same convention: damper pedal, portamento, sostenuto, soft pedal, legato footswitch and hold 2. General MIDI Level 1 names eleven controllers, and of those six switches only the damper pedal is on the list. The rest arrive later; the specification credits GS with the soft pedal and sostenuto.

Two required messages can clear the pedal

Two of the eleven controllers General MIDI requires are 121, Reset All Controllers, and 123, All notes off, each with its value fixed at zero. The specification marks them as messages equipment must respond to in order to comply with General MIDI Level 1. Resetting controllers restores their defaults, and a damper pedal's default is off. Both use the same status byte as the pedal, so a pedal event and a pedal wipe differ by one byte.

What a pedal claim has to produce

ai-midi's FAQ says the model works out pitch, duration, velocity, dynamics and even when the pedal is used; its homepage says the model transcribes sustain instantly. In file terms that claim has one measurable form: a Control Change 64 with a value of 64 or more, later followed by one with a value of 63 or less on the same channel. A pedal-down with no matching pedal-up latches the pedal, and the format defines no automatic release.

Counting notes will not find it

A check that counts note events has no field to look in: the pedal is not one. Two files with identical note lists can differ completely underneath: one carrying a pedal line, one carrying none. The test is a count of Control Change 64 messages, and zero means the file holds no pedal information at all, whatever the converter's page promises. Sustained notes that were cut short are a duration fault, not a pedal one.

Related