Plugin colornotes
Hi everyone,
[Sorry for my english, i'm not a native speaker]
When i'm using the colornotes plugin, i'd like to have all the notes of the same line in the same color. For example, in the following screenshot, Cb, C# and C does not appear in the same color, Cb has the B color in my case. Also, E# has the same color as F.
I've modified the plugin code as follows for the image :
property variant colors : [
"#e21c48", //C
"#e21c48", //C#
"#009C95", //D
"#009C95", //D#
"#5E50A1", //etc
"#CF3E96",
"#CF3E96",
"#bcd85f",
"#bcd85f",
"#F99D1C",
"#F99D1C",
"#fff32b",
]
So, Is it possible to have the same color in the whole line even if there is an alteration ?
Thank you
Comments
That plugin colors note by (MIDI) pitch, and D and D# and Db are different pitches, but Cb is the same pitch a B, same for E# and F.
You could use tpc instead, see https://musescore.org/en/plugin-development/tonal-pitch-class-enum, to differentiate between the latter, but that won't fix the former
In reply to That plugin colors note by … by Jojo-Schmitz
Thank you for the response,
thanks to the tonal pitch class ( and some tries with the code), i finally succeeded to do what i wanted.
Here is the result with and without accidentals colors :
I've modified this part of the code (the code is not optimized at all but it works) :
function colorNote(note) {
if (note.color == black)
if (note.tpc==0 ||note.tpc==7 || note.tpc==14 ||note.tpc==21 ||note.tpc==28) //C
note.color = colors[0];
else if (note.tpc==2 ||note.tpc==9 || note.tpc==16 ||note.tpc==23 ||note.tpc==30) //D
note.color = colors[2];
else if (note.tpc==4 ||note.tpc==11 || note.tpc==18 ||note.tpc==25 ||note.tpc==32) //E
note.color = colors[4];
else if (note.tpc==-1 ||note.tpc==6 || note.tpc==13 ||note.tpc==20 ||note.tpc==27) //F
note.color = colors[5];
else if (note.tpc==1 ||note.tpc==8 || note.tpc==15 ||note.tpc==22 ||note.tpc==29) //G
note.color = colors[7];
else if (note.tpc==3 ||note.tpc==10 || note.tpc==17 ||note.tpc==24 ||note.tpc==31) //A
note.color = colors[9];
else if (note.tpc==5 ||note.tpc==12 || note.tpc==19 ||note.tpc==26 ||note.tpc==33) //B
note.color = colors[11];
else
note.color =black;
else
note.color = black;