cuthbertLab / music21

music21 is a Toolkit for Computational Musicology
https://www.music21.org/
Other
2.11k stars 399 forks source link

Spell pitches according to key during MIDI import if one is given #1144

Open jacobtylerwalls opened 3 years ago

jacobtylerwalls commented 3 years ago

Motivation music21 is not advertised as a high-fidelity MIDI importer/exporter. But it looks like low/medium effort to make pitch instantiation key-aware so that more plausible spellings are chosen.

Feature summary We already convert key signature events from MIDI, so just pass them to the routines that create notes and chords so they can call simplifyMultipleEnharmonics() with a key object.

This will slow down MIDI parsing a bit, but it would probably be worth it. I don't think we have to refactor the midi translate module to do this.

Proposed implementation (just a hunch)

midiTrackToStream():

Intent

[ maybe someday, but not this fall ] I plan on implementing this myself. [ ] I am willing to pay to have this feature added. [x] I am starting a discussion with the hope that community members will volunteer their time to create this. I understand that individuals work on features of interest to them and that this feature may never be implemented.

mscuthbert commented 3 years ago

yes. Good idea. This is one of those things that music21's midi input should be better than the competition on.