craffel/pretty-midi

clear all midi data in pretty_midi.PrettyMIDI

Amo-omA opened this issue · 2 comments

Hello! Thank you for developing this wonderful tool!
My question is: when I use 'pretty_midi.PrettyMIDI()' to create a midi data container, I can't find the command to clear all midi data. Thus the two midis overlap when I use the same container the second time. Can you please tell me how to deal with this problem or if I miss sth in the documentation?
Thank you!

Hi, why do you need to use the same container the second time? You can just instantiate a second class instance, e.g.

pm1 = pretty_midi.PrettyMIDI()
# ... do some stuff with pm1 ...
pm2 = pretty_midi.PrettyMIDI()
# do some stuff with pm2

Thank you! I wanna use loop to create some midi files, but then I realized I can use the loop elsewhere to avoid clear the container...just like you said. Thanks again!