find instrument at given note

• Aug 4, 2023 - 04:41

I have a plugin that needs to apply different rules depending if violin, viola, cello or contrabass. Can I detect the instrument, I want to achieve something like this:

var chord = notes[i].parent
var segment = chord.parent
var measure = segment.parent
var staff = measure.staff
var part = staff.part
var instrument = part.instrument

But this is unable to get part from staff.part, despite from my understanding of docs it is referenced here https://musescore.github.io/MuseScore_PluginAPI_Docs/plugins/html/class…
Alternatively getting the part name would be fine too.


Comments

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