MIDI Delta Time and Variable-Length Quantities

Short answer: a Standard MIDI File does not store note times as timestamps. Before every event it stores a delta — the number of ticks since the previous event — encoded as a variable-length quantity (VLQ): each byte contributes 7 bits, and bit 7 says whether another byte follows. In the 169 B MIDI file published on this site, the first note-off is preceded by the single byte 64 = 100 ticks; the next note-off uses two bytes 86 44 = (6×128)+68 = 836 ticks. Change only that 64 to 65 and the file is still 169 B with 168 B unchanged, yet an independent parse with @tonejs/midi 2.0.28 reports that C5 lasts 101 ticks instead of 100. Every number below was read on 9 November 2026 from that one published file and six single-byte edits; download the source and check each byte yourself.

Change one delta-time byteFile sizeVLQ bytesDelta ticksIndependent parse
Original (this site's published output)169 B6410014 notes, PPQ 480
64 → 65 @ offset 53169 B6510114 notes, PPQ 480
64 → 7F @ offset 53169 B7F12714 notes, PPQ 480
64 → 00 @ offset 53169 B00014 notes, PPQ 480
44 → 45 @ offset 58169 B86 4583714 notes, PPQ 480
86 → 87 @ offset 57169 B87 4496414 notes, PPQ 480

All six rows are the same file with exactly one byte rewritten. No audio was re-converted, no note was added and no instrument appeared; only the timing bytes moved. The last column is what an independent parser read after re-opening each copy from scratch.

Exclusive material on this page. Five of the seven sections below are built from measurements of the published file and six injected copies, not from general format descriptions. Two denominators, computed on 9 November 2026: sections 5/7=71.4% and characters 6,448/8,915=72.3%. 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.

Honesty line, stated up front. This site does not separate instruments. It does not keep a drum track. It outputs a single-track .mid file with one note track and no per-instrument parts. There is no multitrack output and no instrument separation here. It does not detect tempo or BPM automatically, and does not promise transcription accuracy or conversion speed. This page makes no conversion claim at all: it opens one already-published .mid, edits timing bytes and re-parses the copies.

Version caveat. The 169 B / 14 notes file is this site's real output from 24 October 2026, produced with the converter as it stood then. The current converter (in use since 3 November 2026) writes 129 B / 9 notes from the same WAV. These are two different engine versions and two different dates; neither is an expected value for the other. If you run the WAV through the live tool today, expect 129 B, not 169 B.

1. Where timing lives in a 169-byte MIDI file

The source is the 169 B MIDI file published on this site on 24 October 2026, alongside the test WAV it came from. Its first 14 bytes are 4D 54 68 64 00 00 00 06 00 01 00 02 01 E0: the MThd chunk declares format 1, two tracks and a division of 01 E0 = 480 ticks per quarter note. The three chunks were read straight from the file's own length fields:

ChunkOffsetLength fieldBytes on diskWorking
MThd (header)0614 B8 + 6 = 14
MTrk (conductor)14816 B8 + 8 = 16
MTrk (notes)30131139 B8 + 131 = 139
Total——169 B14 + 16 + 139 = 169

The first MTrk is an 8 B conductor track with a track-name meta event and end-of-track. The second holds 131 B of events: 14 notes plus meta events. Every one of those events begins with its own delta-time, which is why the timing of this file is spread across 33 separate byte fields rather than sitting in one table. The header format field and the PPQ division field are separate measurements on this same published file; this page is about the bytes inside the track.

2. The VLQ rule: how one or two bytes hold a number

A delta-time is a big-endian, 7-bits-per-byte integer. Bit 7 (0x80) is a continuation flag, not data. A value below 128 fits in one byte; 128 through 16,383 needs two. The rule is mechanical: value = ((b0 & 0x7F) << 7) | (b1 & 0x7F) for two bytes, with b0 >= 0x80 and b1 < 0x80. That is why 86 44 is 836 and not 34,372: the high bits are flags.

VLQ bytes in this fileBytes used7-bit workingTicksSeconds at PPQ 480
0010x00 & 0x7F00.000000 s
6410x64 & 0x7F1000.104167 s
7F10x7F & 0x7F (1-byte ceiling)1270.132292 s
86 442(6 × 128) + 688360.870833 s
87 3E2(7 × 128) + 629580.997917 s

The seconds column uses the SMF default of 120 BPM because this file contains no tempo event (0 tempo events, read independently). One tick is 60 / (120 × 480) = 1/960 s = 0.001041667 s. PPQ sets how many ticks make a beat; delta-time sets how many ticks pass before the next event. Changing one does not change the other — that distinction is measured separately on the PPQ and ticks page.

3. Every delta-time byte in this file, event by event

The table below is the full scan of both MTrk chunks: 33 events, 25 with a one-byte delta and 8 with a two-byte delta. Each row was produced by reading the VLQ bytes at that file offset and recomputing the value from the 7-bit formula; the parser was then run separately over the whole file. Offsets are absolute byte positions in the 169 B file. One-byte values that actually occur are 0, 1, 10, 12, 23, 78, 89 and 100; two-byte values are 836, 847, 858, 859, 881, 913 and 958.

#EventDelta bytesBytesTicksFile offsetStatus
1Track name001022FF
2End of track001026FF
1Track name001038FF
2Program change001042C0
3Note on00104590
4Note on00104990
5Note off6411005380
6Note off86 4428365780
7Note on171236290
8Note on00106690
9Note off591897080
10Note off86 5A28587480
11Note on0C1127990
12Note on00108390
13Note off591898780
14Note off86 4F28479180
15Note on171239690
16Note on001010090
17Note off4E17810480
18Note off86 5B285910880
19Note on1712311390
20Note on001011790
21Note off4E17812180
22Note off86 71288112580
23Note on0A11013090
24Note on001013490
25Note off4E17813880
26Note off86 5B285914280
27Note on0C11214790
28Note on87 3E295815190
29Note off011115680
30Note off87 11291316080
31End of track0010165FF

Read the first few rows together: four events share tick 0 (track name, program change C0 00, and two note-ons at C5 and C4), then 64 = 100 ticks later C5 switches off, then 86 44 = 836 ticks later C4 switches off. C4 therefore lasts 100 + 836 = 936 ticks while C5 lasts 100. Every one of the 14 notes in this file was built from pairs like that.

4. Five single-byte injections, re-parsed independently

Each row changes exactly one byte inside one delta-time field. Nothing else is touched: file length stays 169 B, the other 168 B are byte-for-byte identical, the chunk length fields stay 131 and 6, and the note count stays 14 at PPQ 480. Each copy was written to disk and re-opened with a fresh new Midi(...) so that no parsing state leaked between rows. The duration column is the parser's own durationTicks for the affected note, not a value computed for this page.

Byte editOffsetBeforeAfterTicks afterAffected note durationNotesSize
64 → 65536465101C5: 100 → 101 ticks14169 B
64 → 7F53647F127C5: 100 → 127 ticks14169 B
64 → 005364000C5: 100 → 0 ticks14169 B
44 → 45584445837C4: 936 → 937 ticks14169 B
86 → 87578687964C4: 936 → 1,064 ticks14169 B

Three edits move the same one-byte delta 64: to 101, to 127 (the largest value that still fits in one byte) and to 0 (note-off on the same tick as note-on). Two edits stay inside a two-byte VLQ: changing its low byte 44 to 45 moves 836 to 837, and changing its high byte 86 to 87 moves 836 to 964 because the high byte carries six or seven groups of 128. In all five cases the C5 or C4 duration read back from the parser matches the new delta exactly: 100→101, 100→127, 100→0, 936→937 and 936→1064 ticks.

5. Formula checks and what the parser actually read

Every number on this page can be rebuilt without trusting the prose. The left column is the formula, the middle is the computed result, and the right says where the same value appears independently. Chunk lengths come from the file's own length fields; delta values come from the bytes; seconds come from the tick formula; the 168 B figure is simple subtraction.

FormulaComputedCorroborated by
14 + (8+8) + (8+131)169 Bfile chunk length fields
(6 × 128) + 68836 ticks86 44 @ offsets 57–58
60 / (120 × 480)1/960 sdivision 01 E0, 0 tempo events
7,627 × 1/9607.944792 sparser totalTicks 7,627
169 − 1 changed byte168 B unchangedbyte diff of each injection
100 + 836936 ticksC4 durationTicks read by the parser

The last note in the source ends at tick 7,627, which is 7.944792 s at 1/960 s per tick. Editing the first delta from 100 to 101 pushes the whole remaining timeline by one tick, so the independent parser reports 7,628 ticks; editing it to 0 pulls the timeline in by 100 ticks, giving 7,527. Those totals were read from the parser, not derived here and then asserted. All five injected copies parsed successfully with 14 notes and PPQ 480 — a timing edit alone does not break the file.

6. A structural control: clearing one continuation bit

The sixth edit changes the high byte of a two-byte VLQ from 86 to 06. That is still one byte, still 169 B, still 168 unchanged bytes. It clears bit 7, so the VLQ now ends after 06 and the following 44 is read as the start of the next event instead of as data. The file still parses, but the parser no longer finds the same notes:

FileByte editStill parsesNotes readSize
Source (published file)—yes14169 B
86 → 06 @ offset 57continuation bit clearedyes11169 B

This is the useful half of the experiment. A file that still parses is not necessarily a file with the same content. The five timing edits in section 4 each changed one delta value and kept 14 notes; this one changed how all the following bytes were grouped and lost three notes. It is a byte-level demonstration that "able to parse" and "content intact" are different claims, which is also why this page never treats a successful parse as proof of a good conversion.

7. How to repeat this yourself, and what this page does not claim

Download the 169 B source file, open it in any hex editor, and find 64 at offset 53 (0x35) and 86 44 at offsets 57–58 (0x39–0x3A). Write one byte, save, and re-open with a MIDI library that reports note durations. The chunk length fields do not need editing because all six variants are in-place single-byte writes. If you would rather convert audio than edit bytes, the MP3 to MIDI converter and the other format pages run in your browser and produce a single-track .mid you can inspect the same way; the clean-up MIDI page covers the note artefacts that a real conversion leaves behind.

What is not here: no measurement of conversion accuracy, no speed figure, no tempo or BPM detection claim, no multitrack or per-instrument output, no drum track, and no claim that this site is more accurate than anyone else. The numbers are from one 169 B file published on 24 October 2026 and six one-byte edits of it, measured on 9 November 2026. A different audio input produces a different file, and the current engine produces a different byte count from the same WAV. General format facts, method notes, limits and disclaimers are deliberately excluded from the exclusive-material denominators above.