MIDI (and MIDI Like) File Timing by snakemeat at 4:12 PM EST on February 25, 2009
I'm looking into timing a MIDI like format (PS2 SQ). I am able to get the tempo of the file from the set tempo command, which seems to be stored in (microseconds/quarter note) units. Now I'm wondering how exactly to count these "quarter notes" so I can do the appropriate math and get the time of the entire track. Am I oversimplifying this by thinking that a total count of notes will be all I need? I understand that I'll need to account for loops, I just don't know how to count notes.
Can anyone explain to me which MIDI commands get counted as quarter notes? I had pondered counting Note On events, but what about times where there is silence? Thanks in advance.
For MIDI and MIDI-based sequences, just about each command has a tick value associated with it that essentially determines timing. Combining this with tempo change events (typically given in microseconds/quarter-note) and resolution (480 ticks/quarter-note is the common default value if it not specified) will allow you to get the time in seconds.
Basically, just do time = sum(ticks*tempo/resolution), summing over every MIDI command to get the timing.
For MIDI and MIDI-based sequences, just about each command has a tick value associated with it that essentially determines timing.
Thanks for all the info, it really helps and makes sense of some values I didn't understand (specifically what this 480 value I found represents). Regarding the tick value described above, are you referring to the delta-time value (which I've read a bit about here) or is there a reference somewhere describing how many ticks each command uses? Thanks again, I really appreciate it.