There is no problem with deltaTime between events in the midi = 0 file format - there is only one track and all events are referenced to the preceding event.
However, how the deltaTime should be interpreted for midi files in other formats? Is it a distance from the previous event in the scope of the entire MIDI file or in the scope of a given track/chunk?
Delta time is the distance from the previous event in the same track.
The spec says:
=
is stored as a variable-length quantity. It represents the amount of time before
the following event. If the first event in a track occurs at the very beginning of a track, or if
two events occur simultaneously, a delta-time of zero is used. Delta-times are always present.
(Not storing delta-times of 0 requires at least two bytes for any other value, and most delta-
times aren't zero.) Delta-time is in ticks as specified in the header chunk.= | |
is any MIDI channel message. Running status is used: status bytes of MIDI
channel messages may be omitted if the preceding event is a MIDI channel message with the
same status. The first event in each MTrk chunk must specify status. Delta-time is not
considered an event itself: it is an integral part of the syntax for an MTrk event. Notice that
running status occurs across delta-times.
It doesn't matter if the file has a single track (like in format 0) or has several tracks, the delta time is always the amount of time before
the following event in that track.
Thank you.
Have a great day.