The MIDI time signature meta message defines the musical time signature of a MIDI sequence.
This message belongs to the category of MIDI meta messages. Since this is a meta message the MIDI event that carries this message may exist in MIDI files, but it is never sent over MIDI ports to a MIDI device.
This message consists of seven bytes of data. The first byte is the status byte and has a hexadecimal value of 0xFF, which means that this is a meta message. The second byte is the meta message type 0x58 and shows that this is a time signature meta message. The third byte is 0x04 and shows that there are four remaining bytes. The fourth byte is the numerator of the time signature and has values between 0x00 and 0xFF (0 and 255). The fifth byte is the power to which the number 2 must be raised to obtain the time signature denominator. Thus, if the fifth byte is 0, the denominator is 20 = 1, denoting whole notes. If the fifth byte is 1, the denominator is 21=2 denoting half notes, and so on. The sixth byte of the message defines a metronome pulse in terms of the number of MIDI clock ticks per click. Assuming 24 MIDI clocks per quarter note, if the value of the sixth byte is 48, the metronome will click every two quarter notes, or in other words, every half-note. The seventh byte defines the number of 32nd notes per beat. This byte is usually 8 as there is usually one quarter note per beat and one quarter note contains eight 32nd notes.
The following is an example of a MIDI time signature meta message.
0xFF 0x58 0x04 0x04 0x02 0x18 0x08
The status byte 0xFF shows that this is a meta message. The second byte is the meta type 0x58 and signifies that this is a time signature meta message. The third byte is 4, which means that there are four remaining bytes. The fourth byte is 0x04, which means that the time signature numerator is 4. The fifth byte is 0x02, which means that the time signature denominator is 2^2 = 4. The sixth byte is 0x18, which is 24 decimal, and means that the metronome will click once every 24 MIDI clocks. The seventh byte is 8, which means that there are eight 32nd notes per beat.
If a time signature message is not present in a MIDI sequence, 4/4 signature is assumed.