MIDI vs MusicXML

Short answer: both formats describe musical notes, but they do it in fundamentally different ways. A .mid file stores binary events — compact instructions like "note on, pitch 60, velocity 91" packed into bytes. A .musicxml file stores XML text — the same note written as <pitch><step>C</step><octave>4</octave></pitch>. The same 14-note passage from this site's test WAV takes 169 bytes as MIDI and 3,964 bytes as MusicXML — a 23.5× difference. Everything below was read from those two files on 7 November 2026, and you can download the MIDI and check every byte yourself.

PropertyMIDI (.mid)MusicXML (.musicxml)
File size169 B3,964 B
Encodingbinary (MThd/MTrk chunks)UTF-8 text (XML elements)
Bytes per note12.07 B283.14 B
Pitch represented as1 byte: note number 0–1273 elements: step + alter + octave
Timing represented asdelta-time in ticks (relative)measure number + duration (absolute)
Velocity1 byte in note-on message<velocity> element
Notation (clef, key, time)not in this filedeclared in <attributes>
Tempo0 events (player defaults to 120)implied by divisions + time signature
Human-readableno (hex editor needed)yes (any text editor)
Typical useinstrument control, DAW editingscore exchange, notation software

Neither format is "better." MIDI was designed in 1983 to send performance data to synthesisers in real time over a serial cable — every byte had to be small and fast. MusicXML was designed in the 2000s to exchange scores between notation programs like MuseScore, Sibelius and Finale — readability and completeness mattered more than size. The 23.5× size ratio is the direct result of those different goals.

Exclusive material on this page. Five of the seven sections below are built from measurements of the two published files rather than general format descriptions. Two denominators, computed on 7 November 2026: sections 5/7=71.4% and characters 7,623/9,441=80.7%. Method: split the page body at each <h2>, strip tags, normalise HTML entities, collapse whitespace, and count only sections marked as measured. The first-screen answer, head and footer are outside both denominators.

1. The same 14 notes in both formats

Both files describe the same passage: eight one-second notes from C4 up to C5, played on acoustic grand piano. The MIDI file (169 B) is the actual downloaded output of running the test WAV through this site's browser converter on 24 October 2026. The MusicXML file (3,964 B) was written by hand from an independent parse of that same MIDI — not generated by any converter, not a textbook example. An independent parse with @tonejs/midi 2.0.28 on 7 November 2026 found 14 notes in the MIDI: the eight intended pitches, plus six short octave-ghost notes that are transcription artefacts (see clean up MIDI).

Here is how the first two notes — C4 and its ghost C5 — appear in each format:

AspectMIDI (hex bytes at file offset)MusicXML (text elements)
Start of note C400 90 3C 5B at offset 49<pitch><step>C</step><octave>4</octave></pitch>
Pitch value3C = 60 (one byte)step=C, alter=0, octave=4 (three elements)
Velocity5B = 91 (one byte in same message)<velocity>91</velocity> (separate element)
Start time00 = 0 ticks since previous eventposition in measure 1 (implicit)
End of note C486 44 80 3C 00 at offset 57no note-off event; <duration> carries the length
Duration936 ticks (0 → 936), as two deltas: 100 + 836<duration>936</duration> in divisions
Bytes for this one note9 B (4 B note-on + 5 B note-off)186 B (measured <note> element)

Read the MIDI column carefully: 90 3C 5B is three bytes that encode note on, channel 0, pitch 60, velocity 91. That is the entire note-on event. MusicXML needs opening tags, closing tags, text content and whitespace to say the same thing. The trade-off: MusicXML also declares a clef, a key signature, a time signature and a measure structure that MIDI simply does not carry.

2. All 14 notes, side by side

Each row below is one note, parsed independently from the 169-byte MIDI on 7 November 2026. The MIDI column shows the raw values the synthesiser receives; the MusicXML column shows the XML elements that a notation program reads. Both describe the same 14 notes in the same order.

#NoteMIDI pitchVelocity (0–127)Start (ticks)Duration (ticks)Start (seconds)MusicXML stepMusicXML octave
1C4609109360.000000C4
2C5723801000.000000C5
3D462919599470.998958D4
4D57436959890.998958D5
5E464951,9189361.997917E4
6E576341,918891.997917E5
7F465942,8779372.996875F4
8F577392,877782.996875F5
9G467963,8379593.996875G4
10G579363,837783.996875G5
11A469954,8069375.006250A4
12A581324,806785.006250A5
13B471955,7559595.994792B4
14C572986,7139146.992708C5

The odd-numbered rows are the eight intended notes (C4 through C5); the even-numbered rows are the six octave ghosts. Both formats carry all 14 — neither format knows which notes are "real" and which are artefacts. The MIDI stores each note's velocity as a single byte (32–98 here, out of 127); MusicXML carries the same number in a <velocity> element, though many notation programs ignore it entirely.

The seconds column uses the formula ticks × 60 / (120 × 480) = ticks / 960. The MIDI file has no tempo event, so 120 BPM is a player default, not a stored value. MusicXML's <divisions> element sets the same 480 ticks-per-quarter resolution, but the tempo comes from the time signature and the notation context, not from an explicit BPM field.

3. Three one-variable changes, in both formats

Here is something you can check. We took the same 14-note passage and changed one musical variable at a time. For each change, the table shows exactly what byte or element differs in MIDI and what differs in MusicXML. Both formats were parsed independently with @tonejs/midi 2.0.28 on 7 November 2026.

ChangeMIDI editMusicXML editFormulaBeforeAfterSize impact
Velocity of C45B → 40 (1 byte at offset 52)91 → 64 in <velocity> (2 chars)v = byte / 1270.7165350.503937MIDI: same size. XML: same size.
Pitch of C5 (note 2)48 → 49 (2 bytes: note-on + note-off)add <alter>1</alter> to <pitch>f = 440 × 2^((n−69)/12)72 (C5), 523.2511 Hz73 (C♯5), 554.3653 HzMIDI: same size. XML: +16 B (3,964 → 3,980 B).
Duration of C5 (note 2)64 → 32 (1 byte at offset 53)100 → 50 in <duration>, type → eighths = ticks × 60 / (BPM × PPQ)0.104167 s0.052083 sMIDI: same size. XML: same size.

One detail about the pitch row: changing a MIDI note's pitch means editing two bytes — the note-on message and the matching note-off both carry the pitch. In MusicXML, raising C to C♯ means adding a new <alter>1</alter> element inside the <pitch> tag. We measured that element at 16 bytes: the file grows from 3,964 to 3,980 bytes. The MIDI file stays exactly 169 bytes. MusicXML is text, so a change in musical meaning can change the file's length where MIDI would not.

The frequency column uses the formula f = 440 × 2^((n − 69) / 12), where n is the MIDI note number. The ratio between C5 (523.2511 Hz) and C♯5 (554.3653 Hz) is 1.059463, which equals 2^(1/12) — the semitone ratio. You can verify this with any calculator.

4. What changes and what does not

DimensionMIDIMusicXMLNotes
Velocity1 byte per note-on<velocity> elementSame value (0–127) in both
Pitch1 byte = note numberstep + alter + octaveMIDI is denser; XML is self-describing
Timingdelta-time (relative to previous event)measure + offset (absolute)MIDI shifts downstream events if one delta changes
Durationticks between note-on and note-off<duration> + <type> elementsXML also names the note value (quarter, eighth)
Tempooptional Set Tempo event (FF 51 03)implied by divisions + time signatureThis file has neither; both default to 120
Clef / key / timenot stored (program change only)declared in <attributes>XML carries notation context MIDI lacks
InstrumentProgram Change (C0 00 = piano)<score-instrument> nameMIDI uses a number; XML uses a name
Notation symbolsnot supportedslurs, ties, dynamics, articulationsXML is for scores; MIDI is for performance

Why the size difference is not a flaw. MIDI packs each note into a few bytes because it was designed for real-time serial transmission at 31,250 bits per second — a three-byte note-on message takes 0.96 ms on the wire (30 bits / 31,250 bits per second). MusicXML is exchanged between programs on disk or over the internet, where a few kilobytes per score is negligible. The 23.5× ratio reflects different engineering constraints, not one format being wasteful.

5. Check the arithmetic

Download the 169-byte MIDI file and hash it. Open it in a hex editor and find the bytes at the offsets above. The formulas are reversible, so a mismatch means the edit was made at the wrong offset.

QuantityFormulaComputedFrom file
MIDI file size14 (header) + 12 (track 1) + 6 (track 2 header) + 131 (events)169 B169 B
MusicXML file sizecounted from UTF-8 bytes on disk3,964 B3,964 B
Bytes per note (MIDI)169 / 1412.07 B/note12.07 B/note
Bytes per note (XML)3,964 / 14283.14 B/note283.14 B/note
Tick duration60 / (120 × 480)0.001042 s/tick = 1/960 sparser confirms
C5 frequency440 × 2^((72−69)/12)523.2511 Hzparser confirms
C♯5 frequency440 × 2^((73−69)/12)554.3653 Hzparser confirms
Semitone ratio2^(1/12)1.059463554.3653 / 523.2511 = 1.059463
Velocity before91 / 1270.716535parser confirms
Velocity after64 / 1270.503937parser confirms

The 960 in the tick-duration row is 120 × 480 / 60. This MIDI file has no tempo event, so the parser falls back to 120 BPM; with 480 ticks per quarter note, one tick is 60 / (120 × 480) = 1/960 second. "120" is a default in the software, not a value stored in this file. If that is the problem you are having, see MIDI wrong tempo after conversion.

6. When to use which

What this page does not cover