I have a midi file and I would like to separate it into two midi files: one file would be only the treble clef notes and one file would be only the bass clef notes.
I suspect it can be done with python's music21 package.
Could you tell me how?
Thanks
I've looked at the documentation of music21. Chapter 31 is about Clefs, but it didn't mention anything about notes. So, there doesn't seem to be a way to tie them together.
In the sections about notes, you can see that a note is say C4. Along these lines, I guess you could go through all the notes, check it against a list of all the treble notes and bass notes and then assign it. But, is there a better way?
I found the following information about a note. Good if one of the characteristics was the staff, but it doesn't look like it.
dir(note) ['GeneralNote', 'Lyric', 'LyricException', 'NotRest', 'NotRestException', 'Note', 'NoteException', 'Rest', 'SYLLABIC_CHOICES', 'StepName', 'Unpitched', 'annotations', 'base', 'beam', 'common', 'duration', 'environLocal', 'environment', 'exceptions21', 'expressions', 'interval', 'noteheadTypeNames', 'overload', 'pitch', 'prebase', 'stemDirectionNames', 'style', 'tie', 'volume']
As for anyone asking this question before, I found this question: Music21: Get all Notes per Instrument from a MIDI File. It talks about separating notes by instrument. Unfortunately that is not the same as separating by staff because an instrument can be on both treble and bass clef.
Any help would be appreciated. Hopefully there is an easy, simple way.