Storing the MusicXML in for each measure separately

13 views
Skip to first unread message

Taylor Akin

unread,
Mar 6, 2023, 12:02:45 AM3/6/23
to music...@googlegroups.com
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

Michael Scott Cuthbert

unread,
Mar 6, 2023, 3:39:54 AM3/6/23
to music...@googlegroups.com
Hi Taylor. I think you need to spend some more time with the music21 user’s guide. Everything you want to do is explained there. Music21 is not a tool for manipulating MusicXML or any other representation directly. 

Best,
Michael

---
Sent from a phone (413-575-6024)
Apologies for typos or general brevity

On Mar 6, 2023, at 00:02, Taylor Akin <ta...@princeton.edu> wrote:


--
--
To Post: email music...@googlegroups.com
To Unsubscribe: email music21list...@googlegroups.com
Archives, Options, etc: http://groups.google.com/group/music21list

---
You received this message because you are subscribed to the Google Groups "music21" group.
To unsubscribe from this group and stop receiving emails from it, send an email to music21list...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/music21list/CA%2BZgTb2b74EDnFPOdTGCGg2kL_pU5A3vZO0XKCa8TQyLKc62Xg%40mail.gmail.com.

Patricio F. Calatayud

unread,
Mar 6, 2023, 9:58:54 AM3/6/23
to music...@googlegroups.com
I've done that with the OMSD library itself. Among the options for display there is a startmeasure and endmeasure or something like that.
The problem is that slurs, ties, and many other elements that start in the previous measure do not show.

Best
P

--
Reply all
Reply to author
Forward
0 new messages