MIDI Division Resolution: Ticks Per Quarter Note
In a Standard MIDI File (SMF), the division parameter specifies how time intervals are measured, determining the precision and timing of every recorded event. This article explains how the SMF header establishes timing resolution using ticks per quarter note (TPQN)—also known as pulses per quarter note (PPQN)—by breaking down the 16-bit division field, the binary structure that enables it, and the mathematical relationship between ticks, tempo, and real-world time.
The Header Chunk Location
Every Standard MIDI File begins with a header chunk designated by the
four-byte ASCII identifier MThd. This header has a fixed
6-byte data payload containing three 16-bit big-endian unsigned
integers:
- Format (bytes 8–9): MIDI file type (0, 1, or 2)
- Ntrks (bytes 10–11): Number of tracks in the file
- Division (bytes 12–13): Timing resolution specification
The division word directly defines the units used for the delta-time values that precede every MIDI event in a track chunk.
Metrical Time Representation in the Division Field
The division field uses a 16-bit signed or unsigned format depending on its most significant bit (bit 15).
To define resolution using ticks per quarter note, bit 15
must be set to 0.
When bit 15 is 0, bits 14 through 0 are interpreted as
an unsigned 15-bit integer representing the number of ticks (clock
pulses) that constitute a single quarter note.
- Bit 15:
0(Metrical timing: ticks per quarter note) - Bits 14–0: Positive integer value ranging from 1 to 32,767
For example, if the 16-bit division field contains the hexadecimal
value 0x01E0:
- Binary:
0000 0001 1110 0000 - Bit 15 is
0, indicating metric resolution. - Bits 14–0 equal
480in decimal. - Result: The file resolution is 480 ticks per quarter note.
Common values used by digital audio workstations and sequencers include 96, 120, 192, 240, 480, and 960 TPQN. Higher values allow for finer micro-timing and more expressive, humanized playback.
Converting Division Ticks to Real Time
Delta times in MIDI track chunks do not store absolute time values like milliseconds; they store elapsed ticks since the previous event. To determine the absolute duration of a single tick in seconds, a MIDI parser must correlate the division value with the current tempo.
Tempo in SMF is defined by the Set Tempo meta-event
(FF 51 03), which specifies the duration of a quarter note
in microseconds (µs). The default tempo in MIDI is 120 beats per minute
(BPM), which equals 500,000 microseconds per quarter note.
The formula to calculate the duration of one tick is:
\[\text{Tick Duration (seconds)} = \frac{\text{Microseconds per Quarter Note}}{\text{Division (TPQN)} \times 1,000,000}\]
Using a standard resolution of 480 TPQN at the default tempo (500,000 µs):
\[\text{Tick Duration} = \frac{500,000}{480 \times 1,000,000} \approx 0.00104167 \text{ seconds (approx. } 1.042 \text{ ms)}\]
If an event has a delta time of 240 ticks under these conditions, the
sequencer waits approximately 250 milliseconds before executing it.
Whenever a tempo change meta-event occurs, the length of subsequent
ticks changes dynamically, while the underlying division value defined
in the MThd header remains constant throughout the entire
file.