In the MIDI protocol each MIDI event carries two pieces of information: 1) the MIDI ticks, which show when the MIDI device should do something; and 2) a MIDI message, which shows what the MIDI device should do.
The MIDI tick is a length of time, the size of which is defined by the time division of the MIDI song. The number of MIDI ticks in a MIDI event is the total amount of time that must pass from the previous MIDI event so that the current MIDI event is executed.
A precise explanation on how the MIDI tick is stored in MIDI events and how it is used is provided in the topic MIDI event. The following is a short description of the MIDI tick.
The length of the one tick is defined by the time division of the MIDI song contained in the header of the MIDI file, and one tick could be any length of time. For example, a one tick could be equal to 8,000 microseconds. Then, if a MIDI event contains the value "2", denoting two ticks, it will be executed 2 * 8,000 = 16,000 microseconds after the previous event.
Every MIDI event contains a number of ticks and this number signifies that this MIDI event should be executed this many ticks after the previous event. Thus, the time at which a MIDI event occurs depends on three things: 1) the number of ticks that the event itself carries; 2) the time of the previous event; and 3) the time division of the whole MIDI song. If the previous event in the example above occurred at 1 second from the start of the song, this event will occur at 1.016 seconds from the start of the song.
A MIDI event that carries zero ticks is executed at the same time as the previous event in the MIDI sequence, unless it is an event that should not be executed at all, such as a meta event. Meta events normally carry zero ticks, but will usually also be placed at the very beginning of the sequence, and will not be sent over MIDI ports for execution.
Musical Instrument Digital Interface (MIDI)