Hello all,
I would like to put the musicXML for each measure into a data structure so that I can ask for a measure and display it with OpenSheetMusicDisplay in the browser given a parsed music21 score. To be a little more concrete, is there a way to do the following?
score = music21.converter.parse(path_name)
measure_list = score['measure']
complete_xml = []
for measure in measure_list:
event = {}
event['measure'] = measure.measureNumber
event['musicxml'] = measure.m21toMusicXML
complete_xml.append(event)
# then make it a JSON object and pass it to the browser
If you have any suggestions, I'd greatly appreciate it! Also, if you have any other suggestions for the flow of storing the data and how to display it in the browser that you think might be helpful, please do share!
Thank you,
Taylor
-- Taylor Akin
A.B. Computer Science, Princeton 2023