craffel / pretty-midi

Utility functions for handling MIDI data in a nice/intuitive way.
MIT License
856 stars 151 forks source link

Add `length` to get the entire duration of midi, similar to `get_end_time` #203

Closed jonata closed 3 years ago

jonata commented 3 years ago

Hi!

I see some discussion on #80. I see that get_end_time does not give me the duration of the midi file in some cases. For a reference, if you look at mido length property, it would calculate all messages' times to get the desired duration value. What about adding this length property just like mido does?

Thanks!

craffel commented 3 years ago

The get_end_time does exactly that - it provides the time of the final event (across all event types). The issue you linked was proposing that get_end_time only operate on note events.

jonata commented 3 years ago

Sorry, but in my tests I am getting different results using get_end_time and mido's length. So get_end_time does not do "exactly that". It seems that it does not get "all event types".