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():
after metaEvents are parsed, get a stream of just key signatures. might need to get this from the conductor track or the score being built.
when calling midiEventsToNote/Chord, pass the key sig object looked up from the stream I just referred to with .getElementsByOffset(offset)
then in those routines call simplifyMultipleEnharmonics()
We should find a way to short-circuit if there is no key defined in the track
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.
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.