MP3 to MIDI Velocity: What the 0–127 Field Can and Cannot Say
Velocity is the one dynamic a MIDI file is guaranteed to carry, and no specification says what it means. A Note On message stores it in seven bits, so every note gets one of 128 values, and General MIDI asks only that a device respond to them. Softer than the neighbour is a claim a .mid can make. Softer by how many decibels is not.
Velocity, answered
- 128 values in seven bits. Velocity is the low seven bits of the second data byte of a Note On message, so a note's hardness is one integer, 0 to 127.
- The spec fixes the resolution, not the scale. General MIDI's requirement reads "Respond to note velocity": it obliges a device to react, and says nothing about how loud any value is.
- The same seven bits carry three things. Note Off and Note On each have a velocity; Polyphonic Key Pressure has a pressure value in the same position.
- A 16-bit source holds 65,536 amplitude levels; the file keeps 128 — a 512-fold reduction, applied once per note rather than once per sample.
Where velocity is written
Velocity has no message of its own. It is the low seven bits of the second data byte of a Note On message, written 1001nnnn 0kkkkkkk 0vvvvvvv: the first data byte is the key number, the second is the velocity, and seven bits give 128 values, 0 through 127.
The same field appears in Note Off, written 1000nnnn, and in Polyphonic Key Pressure, written 1010nnnn 0kkkkkkk 0vvvvvvv, where the specification calls those seven bits a pressure value. The status byte decides what the number means.
What the specification actually requires
General MIDI Level 1 lists four things a compatible instrument must do: allow 24 voices to sound at once, at least 16 melodic and 8 percussive; respond to note velocity; support all 16 channels, with channel 10 reserved for percussion; and support polyphony on each channel.
Three of the four are counts. The velocity requirement is a verb. Neither the list nor the message table says how loud velocity 100 should be, whether the 128 values are spaced evenly in decibels, or whether two compliant instruments will agree. A file can state that one note was struck harder than the one before it, and no more.
How much of the source survives
The audio holds far more amplitude resolution than the file can carry: sixteen-bit PCM has 65,536 quantisation levels, velocity has 128. That is a 512-fold reduction, once per note rather than once per sample, because the converter collapses a whole envelope into one integer.
Take the 16-bit range as 96 decibels and spread the 128 values evenly across it, and one step is 0.75 decibels. That is a parameter, not a specification: the format never says the steps are even, and a device may map them along its own curve.
What the field cannot carry
Velocity is read at the instant a note begins. The field that keeps changing afterwards is Polyphonic Key Pressure, and it is missing from the four-item list, so an instrument can be compliant without answering it.
That leaves the strike as the only mandated dynamic. A crescendo across a phrase can be written as a run of increasing integers, one per note. A swell inside a held note, or between two notes, has nowhere to go unless the device reads the optional field.
What a velocity claim covers
When a converter says it captures velocity, the claim covers one seven-bit integer per note and nothing else. The number is relative to the rest of the file: it records which notes were struck harder than which, not how loud the part is. Turning the part up or down is a job for the receiving device; the file carries no field that asks for it.