Skip to main content
Topic: Colouring Tools (Read 6364 times) previous topic - next topic

Colouring Tools

Dear NWC users,

I have two problems in editing my sheetmusics. I hope someone could help me writing a tool:

Firstly, I want to colour (red) all of clefs.
https://drive.google.com/file/d/0B-H5D05PlaLTUlljaWN0Z3FFQzg/view?usp=sharing

Secondly, I also want to colour (red) all of noteheads which are played in the black key of a Piano.
https://drive.google.com/file/d/0B-H5D05PlaLTTE1oeUttZ19aRXc/view?usp=sharing

I do not have any background in programming, I have read the User Tools in NWC but I cannot understand clearly.

Best regards
Thank you

Re: Colouring Tools

Reply #1
A quick and easy way to colour the clefs is to use the Global_Mod tool installed with the User Tool Starter Kit, which I assume you have installed already:

Press <Alt+F8> to open the user tool dialogue
In the left pane, click on ".File Tools"
In the right pane, select the now available "Global Modification (adp)" tool and press <Enter>

You will be presented with a dialogue box where you can enter the expression "Clef Color=1" (Dont enter the quotes and make sure there is a space between the words "Clef" and "Color").

This directive to Global_Mod will change ALL the clefs in your file to highlight colour 1, which is red, unless you have changed the highlight colours in the Options dialogue.

Changing notes that are on the black keys is a little more challenging and will require a tool that can take into account the clef, the key signature and any accidentals that may apply.
I plays 'Bones, crumpets, coronets, floosgals, youfonymums 'n tubies.

Re: Colouring Tools

Reply #2
Thank you very much, I can change all the clefs into red.
I am still learning to find a way to change the colour of noteheads...

Re: Colouring Tools

Reply #3
> Changing notes that are on the black keys is a little more challenging and will require a tool that can take into account the clef, the key signature and any accidentals that may apply.

Presumably there aren't that many unique notes that need to be red.  Rather than spend the time to write a tool to take all of that into account, couldn't you just run Global_Mod for, for example, all of the F's and then clean up the outliers manually?  I'm afraid I can't play with this at the moment, but that would be my approach.
Sincerely,
Francis Beaumier
Green Bay, WI

Re: Colouring Tools

Reply #4
I am still learning to find a way to change the colour of noteheads...
Code: (Lua) [Select · Download]
-- rg_ColorNotesMIDI.Lua ver 1.0 User Tool <http://nwsw.net/-f9310>
local map = {[0] = 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0}
local playContext = nwcPlayContext.new()

for item in nwcut.items() do
for notepos in item:AllNotePositions() do
notepos.Color = map[playContext:GetNoteMidiPitch(notepos) % 12]
end
playContext:put(item)
nwcut.writeline(item)
end
Code: (nwc) [Select · Download]
!NoteWorthyComposerClip(2.75,Single)
|Clef|Type:Treble
|Key|Signature:F#,C#|Tonic:D
|TimeSig|Signature:4/4
|Chord|Dur:4th|Pos:-3,1
|Chord|Dur:4th|Pos:-5,-3,1,2
|Chord|Dur:4th|Pos:-5,#-2,1,2
|Note|Dur:4th|Pos:-2
!NoteWorthyComposerClip-End
Registered user since 1996

Re: Colouring Tools

Reply #5
Another idea....though manual, not a user tool

Color a certain note for all instances on a staff (notehead and stem)

Select the note
Edit: Find (Ctrl+F) to show the text representation of note
Ctrl+C to copy the text representation
Press Esc
Place insertion point at the start of staff
Press Shift+End to select entire staff
Go to Edit: Filtered Properties (Ctrl+F3)
Ctrl+V to paste into field
Click Next, under Visibility tab, set item color to "whatever color"
Click OK
Those notes will be "whatever color"

 

Re: Colouring Tools

Reply #6
Code: (Lua) [Select · Download]
-- rg_ColorNotesMIDI.Lua ver 1.0 User Tool <http://nwsw.net/-f9310>
local map = {[0] = 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0}
local playContext = nwcPlayContext.new()

for item in nwcut.items() do
for notepos in item:AllNotePositions() do
notepos.Color = map[playContext:GetNoteMidiPitch(notepos) % 12]
end
playContext:put(item)
nwcut.writeline(item)
end
Code: (nwc) [Select · Download]
!NoteWorthyComposerClip(2.75,Single)
|Clef|Type:Treble
|Key|Signature:F#,C#|Tonic:D
|TimeSig|Signature:4/4
|Chord|Dur:4th|Pos:-3,1
|Chord|Dur:4th|Pos:-5,-3,1,2
|Chord|Dur:4th|Pos:-5,#-2,1,2
|Note|Dur:4th|Pos:-2
!NoteWorthyComposerClip-End


It worked. Thank you very much!