Match musicxml code with MuseScore objects
Hello,
If I export a musescore file to xml, one of the notes has the following description:
<note default-x="101.91" default-y="-30.00"> <pitch> <step>G</step> <octave>4</octave> </pitch> <duration>4</duration> <voice>5</voice> <type>half</type> <stem>down</stem> <staff>1</staff> </note>
So the note has voice 5 and exists on staff 1.
How do I get to this information in a plugin?
Thanks!
Luc.
Comments
See e. g. https://musescore.org/nl/project/note-names
To traverse all segments in a score have a look at existing plugins like walk.qml
https://github.com/musescore/MuseScore/blob/3.x/share/plugins/walk.qml
In the seqment you can access all notes in all staves at this position.
The note has properties "staff" and "voice" inherited from the class "element".
https://musescore.github.io/MuseScore_PluginAPI_Docs/plugins/html/class…
In reply to To traverse all segments in… by M.Thum
Thanks.
I think that the walk.qml plugin contains a bug.
The output says:
Debug: type: Chord at tick: undefined color #000000
Debug: type: Chord at tick: undefined color #000000
Debug: type: Chord at tick: undefined color #000000
Debug: type: Chord at tick: undefined color #000000
Debug: type: Chord at tick: undefined color #000000
The code says:
var e = cursor.element;
if (e) {
console.log("type:", e.name, "at tick:", e.tick, "color", e.color);
tick is a property of the cursor, not the element, so the log statment above should be:
console.log("type:", e.name, "at tick:", cursor.tick, "color", e.color);
That generates output:
Debug: type: Chord at tick: 0 color #000000
Debug: type: Chord at tick: 240 color #000000
Debug: type: Chord at tick: 720 color #000000
Debug: type: Chord at tick: 960 color #000000
Debug: type: Chord at tick: 1440 color #000000
Best Regards,
Luc.