-
Notifications
You must be signed in to change notification settings - Fork 40
/
jsonpickleParse.html
18 lines (16 loc) · 4.15 KB
/
jsonpickleParse.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<html>
<head>
<title>Music21 Fragment</title>
<link rel="stylesheet" href="../css/m21.css" type="text/css" />
<script src="../build/music21.debug.js"></script>
</head>
<body>
Append a new DOM from JSONPickle -- not working as of Dec 2019 (or August 2023)
<script>
const pickleIn = '{"m21Version": {"py/tuple": [1, 9, 2]}, "stream": {"_mutable": true, "_activeSite": null, "xPosition": null, "_priority": 0, "_elements": [], "_cache": {}, "definesExplicitPageBreaks": false, "_unlinkedDuration": null, "id": 4424213200, "_duration": null, "py/object": "music21.stream.Stream", "_overriddenLily": null, "streamStatus": {"py/object": "music21.stream.streamStatus.StreamStatus", "_enharmonics": null, "_dirty": null, "_concertPitch": null, "_accidentals": null, "_ties": null, "_rests": null, "_ornaments": null, "_client": null, "_beams": null, "_measures": null}, "sites": {"py/object": "music21.base.Sites", "_lastOffset": null, "_siteIndex": 1, "_definedContexts": {}, "_lastID": -1, "containedById": 4424213200, "_locationKeys": []}, "py/seq": [], "isFlat": true, "autoSort": true, "_storedElementOffsetTuples": [{"py/tuple": [{"lyrics": [], "_notehead": "normal", "_volume": {"py/object": "music21.volume.Volume", "_parent": {"py/id": 6}, "velocityIsRelative": true, "_cachedRealized": null, "_velocity": null}, "_activeSite": null, "xPosition": null, "_priority": 0, "pitch": {"_activeSite": null, "_accidental": null, "_priority": 0, "id": 4424213584, "_duration": {"py/id": 8}, "py/object": "music21.pitch.Pitch", "_overriddenLily": null, "_overridden_freq440": null, "sites": {"py/object": "music21.base.Sites", "_lastOffset": null, "_siteIndex": 1, "_definedContexts": {"None": {"py/object": "music21.base.Site", "obj": null, "globalSiteIndex": 97, "classString": null, "siteIndex": 0, "isDead": false, "offset": 0.0}}, "_lastID": -1, "containedById": 4424213584, "_locationKeys": [null]}, "_microtone": {"py/object": "music21.pitch.Microtone", "_harmonicShift": 1, "_centShift": 0}, "_classes": null, "implicitAccidental": false, "groups": {"py/object": "music21.base.Groups", "py/seq": []}, "defaultOctave": 4, "_fullyQualifiedClasses": null, "_octave": 4, "xPosition": null, "hideObjectOnPrint": false, "_activeSiteId": null, "_step": "C", "fundamental": null, "_idLastDeepCopyOf": 4424212944}, "expressions": [], "id": 4424213328, "_duration": {"py/object": "music21.duration.Duration", "_componentsNeedUpdating": false, "_cachedIsLinked": true, "_qtrLength": 1.0, "_components": [{"py/object": "music21.duration.DurationUnit", "_type": "quarter", "_componentsNeedUpdating": false, "_qtrLength": 1.0, "_tuplets": {"py/tuple": []}, "_link": true, "_typeNeedsUpdating": false, "_quarterLengthNeedsUpdating": false, "_dots": [0]}], "_typeNeedsUpdating": false, "_quarterLengthNeedsUpdating": false, "linkage": "tie"}, "py/object": "music21.note.Note", "_noteheadParenthesis": false, "_overriddenLily": null, "sites": {"py/object": "music21.base.Sites", "_lastOffset": null, "_siteIndex": 6, "_definedContexts": {}, "_lastID": -1, "containedById": 4424213328, "_locationKeys": []}, "_editorial": null, "tie": null, "_noteheadFill": "default", "beams": {"py/object": "music21.beam.Beams", "feathered": false, "beamsList": []}, "_classes": ["Note", "NotRest", "GeneralNote", "Music21Object", "object"], "groups": {"py/object": "music21.base.Groups", "py/seq": []}, "_fullyQualifiedClasses": null, "articulations": [], "_activeSiteId": null, "hideObjectOnPrint": false, "_stemDirection": "unspecified", "_idLastDeepCopyOf": 4424212880}, 0.0]}], "_atSoundingPitch": "unknown", "_classes": ["Stream", "Music21Object", "object"], "groups": {"py/object": "music21.base.Groups", "py/seq": []}, "_fullyQualifiedClasses": null, "isSorted": false, "hideObjectOnPrint": false, "_activeSiteId": null, "flattenedRepresentationOf": null, "_endElements": [], "_derivation": {"py/object": "music21.derivation.Derivation", "_clientId": null, "_client": null, "_originId": null, "_origin": null, "_method": null}, "definesExplicitSystemBreaks": false, "_idLastDeepCopyOf": 4424131600}}'
const jpc = new music21.fromPython.Converter();
const streamObj = jpc.run(pickleIn);
streamObj.appendNewDOM();
</script>
</body>
</html>