Im using the mido library on python to work with the midi file.
Given any midi file, I would like to output a midi file consisting only of the first 10 seconds of the input. I don't see any functions to do this in the library, so im trying to do this through going through each of the tracks.
Im finding a few things confusing. For example, below is what you get when you examine a single track in your midi object.
<meta message track_name name='Slow Strings' time=0> program_change channel=0 program=49 time=0 program_change channel=0 program=49 time=0 control_change channel=0 control=7 value=71 time=0 control_change channel=0 control=10 value=75 time=0 note_on channel=0 note=55 velocity=89 time=15360 note_on channel=0 note=59 velocity=95 time=0 note_on channel=0 note=62 velocity=92 time=0 note_off channel=0 note=55 velocity=64 time=1324 note_off channel=0 note=62 velocity=64 time=12
So do I go through this list of messages in the track and count the time attribute until the running sum exceeds 10000 (milliseconds)? I don't think so, because looking at the piece on musescore, nothing significant haappens 15.36 seconds into the song.
I read here, that the times aren't in milliseconds, but delta times, which must be converted to milliseconds through PPQ (pulses per quater note). Is this correct, and if so is using a running sum of time the right approach to creating an output midi of time 10 seconds?