marcomusy / pianoplayer

Automatic fingering generator for piano scores
MIT License
719 stars 81 forks source link

Enhancement: MIDI Output with encoded fingerings #34

Open Cool-Joe opened 3 years ago

Cool-Joe commented 3 years ago

Because MusicXML is nice for further editing, printing oder PDF output, but not ideal (and sometimes tricky or buggy) for automatic reading e.g. in player applications. The idea is to provide an option to output the notes to a standard MIDI file with encoded fingerings. Music21 can output MIDI easily, however I do not know which features it supports. Fingerings could be stored as text events or (what I would prefer) just use the channel information: You could easily store the fingering (1 - 10) as MIDI channel information (1 - 16), what would be ideal for further processing.

PRamoneda commented 3 years ago

Hi! I am Pedro master student at MTG (Barcelona).

Do you have some idea of how to implement this enhancement?

Maybe extending the functionality of music21 midi classes? https://github.com/cuthbertLab/music21/blob/7498a6ee3ec2592a097ac243d6042da3b85e8b3d/music21/converter/subConverters.py#L1019 https://github.com/cuthbertLab/music21/blob/7498a6ee3ec2592a097ac243d6042da3b85e8b3d/music21/pitch.py#L2447

marcomusy commented 3 years ago

Hola Pedro, to be perfectly honest I wouldn't know how to do it... maybe you can get help from the maintainers of music21, if they are interested in such a feature. On the pianoplayer side it's surely far from perfect (especially for chords) and will need some improvements as soon as i find the spare time to do it :)

Cool-Joe commented 3 years ago

Maybe extending the functionality of music21 midi classes?

IMHO extending music21 isn't necessary as it already can output MIDI data. Instead the encoding of key fingerings as channel information would have to be implemented inside pianoplayer.

PRamoneda commented 3 years ago

ok yeah, I understand that. However, it's needed to create the fingers with the same duration (and then, the same resolution) as the music21 generated midi. Well, I think I can do that from pianoplayer! I will try to implement it in the following weeks :D

PRamoneda commented 3 years ago

what is beam?

marcomusy commented 3 years ago

it's the staff. Typically beam=0 is the right hand and beam=1 the left.

PRamoneda commented 3 years ago

Ok thank you so much @marcomusy! And a last question in the reader class. What is the purpose of sfasam variable. here a direct link https://github.com/marcomusy/pianoplayer/blob/735ce50f89fa27896e373264ae2488c56b579687/pianoplayer/scorereader.py#L84

I understand the meaning but not the purpose :)

marcomusy commented 3 years ago

the idea here is that notes in chords are never played really simultaneously, so the time of each note in the same chords is slightly modified to make them happen in a rapid sequence with time difference 0.05.

MaximeHoude commented 3 years ago

I'm late to the party, I can not really help, but I also agree with OP, this enhancement will be a great addition to the projet: it's exactly what I'm looking for. Thanks!