Music Software Development

MIDI ticks to milliseconds calculator

MIDI files and sequencers count time in ticks, not seconds. How long a tick lasts depends on two numbers: the file’s resolution in ticks per quarter note (PPQ) and the current tempo. Set them below to convert ticks, milliseconds and bar positions in either direction.

Calculator

Resolution and tempo

500000 µs per quarter note · 1 tick = 1.0417 ms

Ticks → time 1920 ticks = 1000 ms · bar 2, beat 1, tick 0
Time → ticks 250 ms = 240 ticks
Bar:beat:tick → ticks
3:2:240 = tick 4560
Tempo from a file 428571 µs per quarter = 140 BPM
Header division SMPTE: 25 fps × 40 ticks per frame

Note lengths in ticks

At 480 PPQ and 120 BPM. * means the PPQ cannot represent the value as a whole number of ticks.
NoteStraightDottedTripletStraight length
Whole1920288012802000 ms
Half96014406401000 ms
Quarter480720320500 ms
Eighth240360160250 ms
Sixteenth12018080125 ms
32nd60904062.5 ms
64th30452031.25 ms

The formula

A Standard MIDI File stores tempo as microseconds per quarter note in a Set Tempo meta event (FF 51 03 tt tt tt), not as BPM. One quarter note lasts that many microseconds and contains PPQ ticks, so:

ms per tick = tempo (µs per quarter) / PPQ / 1000
BPM         = 60,000,000 / tempo
tempo       = 60,000,000 / BPM

At 480 PPQ and 120 BPM (500,000 µs), one tick is 1.0417 ms and a quarter note is 480 ticks = 500 ms. If a file has no Set Tempo event, players assume 120 BPM. Halve the tempo and every tick lasts twice as long, while the tick counts in the file stay the same. That is why MIDI timing survives tempo changes but needs a tempo map to turn into seconds.

When the tempo changes

To find the time of a tick in a song with tempo changes, walk the tempo events in order and add up each segment at its own tempo. Event times in a track are deltas, so first add them up to get absolute ticks. For example, at 480 PPQ with 120 BPM until tick 480 and 60 BPM after it, tick 960 is 500 ms + 1000 ms = 1500 ms. The MIDI file analyzer does this for a real file and shows every event’s time, and reading and writing MIDI files shows the code.

Bars, beats and ticks

A beat is the time signature’s lower number as a note value. In 4/4 a beat is a quarter (PPQ ticks); in 6/8 a beat is an eighth (PPQ / 2 ticks), so a 6/8 bar at 480 PPQ is 6 × 240 = 1440 ticks. Sequencers usually count bars and beats from 1 and ticks from 0, as this calculator does. The bar calculation assumes a single time signature from the start of the song.

Choosing a PPQ

A PPQ divisible by 2, 3 and 4 represents straight, dotted and triplet notes exactly. 96 PPQ handles sixteenth triplets (16 ticks) but not 32nd triplets. 480 and 960 PPQ, the common DAW defaults, handle them all down to 64th notes. A higher PPQ only adds timing precision: 960 PPQ at 120 BPM gives about 0.52 ms per tick, already finer than you can hear. The header’s other form, SMPTE division, counts frames and ticks per frame instead and ignores tempo; the division field above decodes both. For delay times in milliseconds, use the BPM to ms calculator.