cuthbertLab/music21

Add xmlID as a property of at least note and rest objects when parsing xml/mei scores

Opened this issue · 1 comments

Motivation

Adding xmlID as a property would be useful to people who want to be able to go between music21 analysis and the score itself easily. This would greatly facilitate taking analysis done with music21 and encoding it into the symbolic notation file itself. This would be similar to how scores parsed in music21 have a "priority" property which is very useful when analyzing kern scores and wanting to go between music21 and the symbolic notation file easily.

Feature summary
Add xmlID as a property on objects of potentially all types, but at the very least notes and rests. Alternatively, since this only applies to xml and mei scores and those file types do not make use of the "priority" property, priority could serve double duty as the xml id property name. Though I believe priority is currently ints and xml ids would have to be strings, and xml ids can't be used in the sort order (object.sortTuple()) like priority can.

Proposed implementation
n = note.Note()
print(n.xmlID) # -> should print "None" for notes that aren't from an xml or mei file (or are but don't have the property), and the xml id string otherwise

Optionally, describe the implementation or the interface, in code or pseudocode.

Intent

I could potentially submit this pr myself if there is interest for it.
[√] I plan on implementing this myself.
[ ] I am willing to pay to have this feature added.
[ ] 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.

If this change gets approved and merged, I would make the same change to converter21's MEI importer (and then re-use those xmlIDs, if present, in converter21's MEI exporter).