I'm processing a bulk of midi files that are made for existing pop songs using music21.
While channel 10 is reserved for percussions, melodic tracks are all over different channels, so I was wondering if there is an efficient way to pick out the main melody (vocal) track.
I'm guessing one way to do it is to pick a track that consists of single notes rather than overlapping harmonics (chords), and the one that plays throughout the song, but is there any other efficient way?
The SMF format has no restrictions on how events are organized into tracks. It is common to have one track per channel, but it's also possible to have multiple channels in one track, or multiple tracks with events for the same channel.
The organization of the tracks is entirely determined by humans. It is unlikely that you can write code that can correctly determine how some random brain works.
All you have to go on are conventions (e.g., melody is likely to be in the first track(s), or has a certain structure), but you have to know if these conventions are actually used in the files you're handling.
music21: picking out melody track