craffel/pretty-midi

Add event-based representation for training architectures used in NLP

gulnazaki opened this issue · 1 comments

I am using pretty-midi to train a Transformer on LMD. I find the event-based representation more useful for this task than piano roll, see LakhNES (without the NES mapping and monophonic filtering) or Performance RNN representations.

I am thinking of adding a get_event_representation, that seperates note on and note off events and sorts them accordingly, jointly for all selected instruments. It could return a list of note events (optionally pitch bends and control changes). Also, tempo, key signature and time signature changes could be added on respective times.

If you find this feature addition helpful I can make a PR.

Hi there, I think this would be best left to be implemented in user code. You also could make it an example (https://github.com/craffel/pretty-midi/tree/master/examples).