craffel / pretty-midi

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

Is there any way to split a MIDI files into smaller segements based on time in secods/ milliseconds? #213

Closed VijayIyer closed 2 years ago

VijayIyer commented 2 years ago

Question: Let's say I have a MIDI file which when played is 20 seconds long. Is there a way to split it into 2 smaller MIDI files of length 10 (in seconds).

craffel commented 2 years ago

You can use adjust_times for that, see e.g. https://github.com/craffel/pretty-midi/issues/149