GestureSynth.me

Music calculator

MIDI Set Tempo Calculator

Convert quarter-note BPM into MIDI file tempo in microseconds and the hexadecimal Set Tempo event bytes.

midi tempo bytes ff 51 calculator

MIDI Set Tempo Calculator guide

Use this tool to verify a MIDI exporter, write a fixed tempo event, or understand a tempo value found in a Standard MIDI File.

Play the instrument ↑
Worked example
At 120 BPM one quarter lasts 500,000 microseconds.

Formula and units

Divide 60,000,000 microseconds per minute by BPM. Round to the nearest whole microsecond for the event's 24-bit big-endian payload. The event starts with FF 51 03, followed by three bytes containing that number.

Worked examples

At 120 BPM one quarter lasts 500,000 microseconds. Its hexadecimal value is 07 A1 20, so the event bytes are FF 51 03 07 A1 20. The tool also shows the BPM implied by the rounded stored value.

At 60 BPM one quarter lasts 1,000,000 microseconds and the payload is 0F 42 40. Doubling the tempo halves the duration. A tempo byte value stores time per quarter note rather than beats per minute.

Read the event structure correctly

An event has a delta-time field before its message in a MIDI track. The calculator returns the event bytes only. To place an event at a specific point you also need the preceding delta time encoded as a variable-length quantity. Zero delta time commonly applies at the very start of a sequence.

FF indicates a meta event, 51 identifies Set Tempo, and 03 is the length of the payload. Read the three following bytes in high-to-low order. This byte sequence applies to the file format and should not be sent over a MIDI cable as though it were a real-time tempo message.

Keep tempo maps separate from individual note duration

The event describes a quarter-note duration until a later tempo change. To determine elapsed time over a passage with several Set Tempo events, divide the passage into intervals according to its tempo map. A note that crosses a change can straddle two different rates.

MIDI clock is a distinct synchronization stream with 24 messages per quarter note. A PPQ-based MIDI file can store hundreds of ticks per quarter while its live MIDI clock remains 24 per quarter. Use the linked clock or tick calculator for those timing relationships.

Check common byte values before testing an exporter

Enter 150 BPM. A quarter lasts 400,000 microseconds and the payload is 06 1A 80, so the full event is FF 51 03 06 1A 80. A raw byte inside a meta event payload can have its high bit set because it is part of the length-delimited payload. Live channel message data has different rules.

At 90 BPM the exact duration is a repeating 666,666.666 microseconds, so the encoder stores 666,667. To see the impact, divide 60,000,000 by the stored integer. The implied rate is near 90 but not exactly equal. Inspect the rounded timing quantity if two MIDI generators display the same approximate tempos while storing one different low byte.

For a fixed 120 BPM file with 480 ticks per quarter note, one tick here represents about 1.041667 ms because 500,000 microseconds is spread over 480 ticks. That relationship applies through regions governed by the same tempo. To verify a whole passage, read the track's actual tempo change positions. If a MIDI file uses SMPTE timing instead of quarter-note divisions, apply the timing convention stated in its header before using tempo data to infer time. Start with a single isolated event to validate byte order before comparing a complete exported track.

Inputs and assumptions

The tool calculates from the values in the form. Keep the reference and units visible when copying the result to session notes. The displayed precision describes the arithmetic and may exceed what your meter, source file or score can support.

Answers before you play

Common questions

Are the byte values rounded?

Yes. The MIDI event can only store whole microseconds. The displayed encoded BPM reflects the rounded value, so for some decimal tempo values it differs slightly from the entered BPM.

Can this read a complete MIDI file?

This page encodes one event from a known tempo. A complete file may contain running status, multiple tracks, several tempo events or SMPTE timing. Use a file parser if you need its complete tempo map.

What if my tempo is in dotted-quarter notes?

Convert the musical pulse to quarter notes first. A dotted-quarter rate of 80 per minute corresponds to 120 quarter notes per minute, so enter 120 if the beat unit is written as a dotted quarter.

Should I enter the number of ticks per quarter here?

The encoding only needs tempo. The ticks-per-quarter field belongs to the file header and is interpreted alongside tempo when mapping musical ticks to elapsed time.