Method to crop PrettyMIDI object.
b-boechat opened this issue · 1 comments
Feature request: a method that crops a PrettyMIDI object. The user provides a start time and end time.
This can be trivially implemented using PrettyMIDI.adjust_times
. However, the documentation for adjust_times
isn't clear that events outside the provided time ranges are removed. I was halfway to manually implementing it myself by modifying events (and adjusting ticks) when I saw that the tutorial alludes to the cropping capabilities of adjust_times
, which can then be understood by reading the method's source code.
One possibility would be to add this information to the docs. But I think pm.crop(start_time, end_time)
is more clear (and searchable) than pm.adjust_times([start_time, end_time], [start_time, end_time])
.
I would happily contribute the (trivial) code if this is deemed a useful addition.
Sure, sounds good! Thanks.