How can I color stem for each note (with colors depending of string and/or pitch)

• Mar 11, 2015 - 07:47

Morning, I would like create a plugin for violin score in order to color the stem of note related to the violin string (1rst position) , and not related to the head color of note ( head color could be related to fingers or other).
I saw plugins related to change colors, shape of the head note or to set finggering table in text, upon scorse;
But I didn't see how to access to the stem object or properties , to change color or thickness of it:
Could you help me on stem description langage ?

It is to help children with a kind of "musical dislecsy" in score reading

Best regards


Comments

In reply to by Jojo-Schmitz

Yes it's wright : hamp is stem where you can see if the note is a semiquaver and so on ...
and scorse is score ....

Sorry ; the correct words facilate the correct solution :-)

So may be I didn't find because of that ...

And so I set the correct words on my first post

In reply to by Jojo-Schmitz

I saw in chord objet concerning stem only this:
"noStem boolean whether the chord has a stem or not. The chord needs to be retrieved from a cursor first "
But nothing about color of stem of the chord , could you indicate which object I have to manipulate , in order to make an equivalent action to the "right click" on a stem and then a little window appears and Inside it, we can change the color of stem in the musecore application (without plugins)
I hope to well explain my goal

In reply to by zenplus

I'm affraid the current plugin frameworks (neither 1.x nor 2.0) don't allow access to that. The Inspector (in 2.0) however should. As does right-click in 1.x.

Edit:
Actually in 2.0 it should work, it should inherit the color property from Element, and I think this is also use in the (2.0 version of the) ColorVoices plugin

In reply to by Jojo-Schmitz

I download beta version 2 with Inpector :
Moreover with "pluggin creation mode", I guess I saw a way to create on-line pluggin, exactly like you can create vba macro with vba excel through actions which are automatically translated to code lines in a new vba macro. (I refer to what I know)

But If it is, I didn't manage to transform my action on stem color on score in a line of code in pluggin within the creation pluggin mode.

Neither any other action: how can I act to do that ?
thanks for your help

An other point should be not in this section, it is like a "change request"
For getting more confortable score reading for children, from my expérience, color graphic possibilities are very powerfull for them: and possibilities on head note are very well-done for that in musescore;
unfortunately, stem are very thin ; is it possible to add possibilities to adjuste Thickness and color of stem through parameters , drived in pluggin ?

Best regards

Thanks.

I saw now how to modify the stem thickness in Style/ Général

And I will explore the voice color pluggin to understand how color is inherit from Element

Best Regards

In reply to by [DELETED] 5

var chord = ...
if (chord.hook)
chord.hook.color = "#546734"
if (chord.stem)
chord.stem.color = "#546734"

this works Under betaversion of musecore ?

If it is: How can I adapt plugin in *.js format into *.qml format
I tried but I think I don't understand the qml structure file compared to js one: (syntax error)
Do you know URL where It is explained ?

Or maybe an simple example of a same pluggin in these two formats to understand how translate js format in qml format.

Again, I go on to try, mixing your advices
I use colornote. qml , because handling pitch note & color, closest what I would like doing, that means handling note pitch (violin string) & stem color.
Therefore in colornote.qml, I introduce juste after the "while", this
var chord = cursor.element
if (chord.hook)
chord.hook.color = yellow
if (chord.stem)
chord.stem.color = yellow

That is;
property variant yellow : "#e6b432"
....
while (cursor.segment && (fullScore || cursor.tick < endTick)) {
if (cursor.element && cursor.element.type == Element.CHORD) {
var chord = cursor.element
if (chord.hook)
chord.hook.color = yellow
if (chord.stem)
chord.stem.color = yellow
var graceChords = cursor.element.graceNotes;
....
Then,
With Beta version 2, no syntax error, but no effect neither on hook color neither on stem color.
With version 2.0.RC, syntax error concerning hook & stem; that is
Warning: QMetaProperty::read: Unable to handle unregistered datatype 'Ms::Hook*' for property 'Ms::Chord::hook'
Warning: QMetaProperty::read: Unable to handle unregistered datatype 'Ms::Stem*' for property 'Ms::Chord::stem

And the end, I don't manage to come back to beta version 2

So I'm not expert in programming; I can understand in exploring what it's working and not.
Maybe you can notice something obviously wrong ?

In reply to by Jojo-Schmitz

The code was still not right. I made some more changes in 1a66cfbadc

I can now color stem, hook, beam and slash for accaciaturra using

if (cursor.element.hook)
cursor.element.stem.color = "#FF0000"
if (cursor.element.hook)
cursor.element.hook.color = "#FF0000"
if (cursor.element.beam)
cursor.element.beam.color = "#FF0000"
if (cursor.element.beamSlash)
cursor.element.beamSlash.color = "#FF0000"

In reply to by [DELETED] 5

Thanks a lot :
"1a66cfbadc" >> Does it mean I have to download an other version ?

And concerning vocabulary, what is beam and slash ; is it specific to accaciaturra ? do they (beam & slash) exist also for "normal note" ?

The piece of pluggin you described above, can be used also for "normal note " ?

and what about stem

Thanks again for your help

In reply to by [DELETED] 5

I guess it is rather

if (cursor.element.stem)
cursor.element.stem.color = "#FF0000"
if (cursor.element.hook)
cursor.element.hook.color = "#FF0000"
if (cursor.element.beam)
cursor.element.beam.color = "#FF0000"
if (cursor.element.stemSlash)
cursor.element.stemSlash.color = "#FF0000"

I've now updated the color voices plugin accordingly

In reply to by Jojo-Schmitz

So now questions which are so obvious for you;

•The latest MuseScore code is always available in the GitHub repository.

I understood that the code "1a66cfbadc " is somewhere in the Github
but where exactly ?
and how I can upgrade may 2.0 RC version with the nightly build ?

In reply to by Jojo-Schmitz

OK thanks
I try with the latest Windows Nightly I found , that is "R.9ab4e3e Nightly build";

Now my pluggin is working for "normal note" (not yet for GraceNote)

Just a question about beam when for example you have 4 notes linking within a beam: how can you deal with individual color note beam ?
Till I find a solution, I let beam black and I color only notes with their hook: it is easy reading

Thanks all for your help; It is very convenient to adjuste color & hook note upon the violin string for children (they choose their string color)

I go to handle the "note name" and a way to sing the note name for children having difficulties in reading score, that is preventing them to access an convenient violin playing (violin is enough difficult without these kind of difficulties)

One more : all, thanks for your help and I wait to go further a new version :-)

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