Reputation: 419
I am trying to figure out the duration of a sequence of midi notes in a *.MID file using NAudio 1.7. The midi file I'm using reports "EndTrack" at 1507 which is the time of the last NoteOff. I would have expected the value to be 1536 which is the duration of a 4-bar phrase.
Where else would this information be represented or how do I calculate it?
Upvotes: 0
Views: 662
Reputation: 180210
The EndTrack
event is a separate event that can have its own time.
If the MIDI file does not bother to align the end to a measure, then that's what you get.
If you want to count the number of measures in the file (which might not make sense for all files), you have to round up the last tick value yourself.
Upvotes: 2