Unique identifiers for notes and such

• Jan 14, 2021 - 16:28

Hi fellow Musescore users,

I'm currently tweaking the Musescore's code for my own purpose, and I'm searching for a way to uniquely identify the notes in a score.

To give a little more context, I'm tweaking the SVG export to export the Segments in a visual way. You can check the attached file for the resulting image (check the source to see the "Segments" that were added).

Now, in the SVG code, I would like to link each Segment to a list of corresponding notes. My first guess was to use svg's data-* attributes, but individual notes (nor chords, nor any other objects as far as I could find) don't seem to come with unique identifiers.

Current SVG looks like this:

<path class="Segment" data-measure="1" data-tick="0/1" fill="#c0c0c0" fill-rule="evenodd" d="…"/>
<path class="Segment" data-measure="1" data-tick="1/2" fill="#c0c0c0" fill-rule="evenodd" d="… "/>
<path class="Segment" data-measure="1" data-tick="5/8" fill="#c0c0c0" fill-rule="evenodd" d="…"/><path class="Note" data-pitch="43" data-display-duration="1/4" data-actual-duration="1/4" data-staff="2" data-measure="2" d=""/>
<path class="Note" data-pitch="50" data-display-duration="1/4" data-actual-duration="1/4" data-staff="2" data-measure="2" d=""/>

What I would like:

<path class="Segment" data-notes="1,2" data-measure="1" data-tick="0/1" fill="#c0c0c0" fill-rule="evenodd" d="…"/>
<path class="Segment" data-notes="…" data-measure="1" data-tick="1/2" fill="#c0c0c0" fill-rule="evenodd" d="… "/>
<path class="Segment" data-measure="1" data-tick="5/8" fill="#c0c0c0" fill-rule="evenodd" d="…"/><path class="Note" id="1" data-pitch="43" data-display-duration="1/4" data-actual-duration="1/4" data-staff="2" data-measure="2" d=""/>
<path class="Note" id="2" data-pitch="50" data-display-duration="1/4" data-actual-duration="1/4" data-staff="2" data-measure="2" d=""/>

Does anyone have any clue on how I could make this?

Thanks!

Attachment Size
bury-a-friend-billie-eilish_band-1.svg 156.42 KB

Do you still have an unanswered question? Please log in first to post your question.