Writing my first plugin - coloring notes based on chord tones

• Mar 18, 2023 - 16:36

I've just installed 4.0, and I want to write a plugin for jazz lead sheets that will color chord tones, based on the chord symbols in the score. For example, if the note is being played while a Bb7b9 is relevant, it would color Bb D F Ab C (say all green), with the others being black.

I see the code for colornotes, which tells me something. Can someone point me to info on how I would be a able to 1) tell for a given note, if there's a chord symbol over it, 2) given a chord symbol get the chord tones. Other than that, I'm all set :-)

The hard part may be to say what chord to use in some cases. For example if the first chord symbol in a measure starts on the second note, one could look forward to the first chord symbol in that measure, but OTOH it might be better to use the last chord symbol in the preceding measure. I suppose I'd just pick one, and people could always force the behaviour by changing the score.


Hi Rob
All the best for your first plugin. I too need a plugin but I dont know where to start.
I have read that it needs QML language. Do you need to build it using QML only ? Or you can use some other language also?
IT is not my field. So sorry for basic questions :P
Thanks in Advance

Regards ,

Re 1) tell for a given note, if there's a chord symbol over it.
segment.annotations see apidoc

Re 2) given a chord symbol get the chord tones.
Thanks to the heart warming community here, Chord symbol syntax contains a link to the musescore internal chord to note function src, which is not exposed as plugin api, and useful alternative plugins / libraries.

See the latest Chord ID and Roman numeral analysis where the marvelous Expand chord symbols into notes plugin by markshepherd is utilized.

The current plugin dev environment for musescore 4 is harsh, pls seePlugins for 4.x. You may want to write for musescore 3 instead, see Plugins for 3.x.

In reply to by msfp

EDIT: This applies to MU3.6
But note that if you walk through the score using:

while(cursor.segment && cursor.tick < endTick) {


you will not see chord symbols that have no note under them.

See also:
Adding a chord symbol from a plugin at a position where there is no note.

To see all the chord symbols you need a separate walk and use:

var segment = curScore.firstSegment();
while (segment) {

segment = segment.next;

As in attached

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