-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
get_end_time only inspects Notes and PitchBends #80
Comments
Resolved in 22fea72. |
Hi @craffel , can you elaborate on what motivated you to inspect all event types? I see advantages to only using note events. I'm only thinking about this because I ran into an issue with a midi file that had tempo change events well after any notes were played. The tempo change events happend for about 20 minutes, yet the music lasted only 5 minutes. None of these tempo changes affected sound output because there were no note events to report the tempo. When I applied the If |
Well, there is information in events other than notes, so presumably those should be considered part of the song. For example, if the sustain pedal is on (according to a CC value), the note should ring (and be modified by pitch bends) after the note off. Or, in a MIDI karaoke file, there may be a lyrical section after the rest of the instruments stop playing. As an aside, if you'd like to get the end time of the last note, it should be a one-liner: |
Good points, thanks for elaborating and for the one-liner. My immediate problem is solved. I just want to give my two cents on the larger issue of the get_end_time() method. The way that I see get_end_time() used in your code base suggests it is mostly for cropping wav files synthesized from midi files. And in that case the method can give misleading values. Lyrics don't get synthesized and sustained notes will only last for so long, maybe 1 second. So lots of meta events happening 5, 10, or more seconds after the end of the last note would needlessly increase the size of the midi audio arrays. Using the one-liner you wrote, I took the difference of get_end_time() and the one-liner for a corpus of 221 videogame midis. So I ended up with 221 time differences.
My test corpus shows 4.5% of files with more than 1 second of events after the end of the last note. So yeah, I acknowledge that we are talking about a small fraction of total files here. But my guess is most of these files have nonsense events at the end rather than useful information. It could be different with your lakh midi dataset. There might be a much smaller fraction of files with meta events after the music. There might be many cases where lyrics continue after the music, etc. I haven't had time to test it. |
Which codebase are you referring to? It's used twice in
If this is an issue then
Sounds like a problem with the MIDI file more than anything else :) |
I am referring to the way Even though the fast_fluidsynth code isn't part of the official codebase for pretty midi, I've ended up using it in the Yes, after looking at how you've used get_end_time() in This whole rant started with me trying to figure out why that one midi file had so much silent audio. Now I understand how get_end_time works and how it fits into the larger picture, so I'm okay with how things turned out. Thanks again for your thoughts and patience. |
Sounds good :) now at least people will understand the rationale! |
It should inspect all event types.
The text was updated successfully, but these errors were encountered: