Skip to main content
Topic: How do I make a script to effect only certain notes? (Read 30119 times) previous topic - next topic

How do I make a script to effect only certain notes?

I am working with piece for the childerns bell choir at church.  All the bells are colored coded.  Example C is red, etc.  I am trying to get the notes on the sheet music to have the same color as their corresponding bell.  Example the middle C note is red, the D is green, etc.  I have already seen what I takes to add the color to the score from other threads but here is my real question.  I have made the whole staff not visible in it's property menu.  Now I want to make a specific note visibile on the whole staff.  It would take me forever to highlight each middle C individually and make it visible again.  Those anyone know a script that I could use to make all of a certain note(ex the middle C) visible and leave the rest hidden.  I was playing around with the visibility script but I don't think it will work.  I appreciate any help I can get.  Thanks in advance

Re: How do I make a script to effect only certain notes?

Reply #1
I too have been working recently with childrens (and adults) bell choir music at church.  I have been dabbling with a number of scripts, both to be run on "clips" via user tools and to be run on entire "nwc" files via command line.

One of my scripts is designed to "highlight" one or more notes, specified as a list of bell names on the command line.  Unfortunately, NWC is currently quite limited in what it can do to individual notes of a chord.  The color and visibility options for example apply to the entire chord, and cannot apply to any subset of it.  My current approach is to "highlight" the given notes by leaving them alone, and change all other notes to "x" noteheads.  This allows the desired bell notes to stand out, while leaving a "shadow" of the other notes to help follow what is going on overall in the group.

Another approach I am exploring is to operate on an entire NWC file, and have the script generate a whole new staff with just the desired notes in it.  This would allow changing the note colors for example, and layering could be used to try to superimpose the colored notes back on the original score.  This approach could also be used during playback, to hear just the desired notes (perhaps with a "metronome" to fill in the gaps), or the desired notes loud and the other notes soft, or just the other notes (to possibly practise with).

I am also exploring a script to remove "optional" bells from a score that is for more octaves than the choir can support.  Optional bells would include bells outside a specified range, as well as bells within parenthesis or brackets (which I am working on how to add).
I also have a script to generate statistics on how many times each bell is rung in a piece (which also indicates the set of bells needed), and what range of measures each bell occurs in.

I have many other ideas for using NWC for handbells - does any of this interest you?  I was thinking about starting up a NWC forum thread just for handbells.  Anyone out there interested?

[One other note - there is a script out there called "parts" which can remove all notes but one.  This is problematic for handbells, as a single bell player will often have two or more notes to play at once, and even with just one handbell, you'd want to highlight up to three different notes (e.g. C#, Db, B##)]

Re: How do I make a script to effect only certain notes?

Reply #2
I have made the whole staff not visible in it's property menu.
I'm confused as to how you did this. There is no 'Visibility' option in Staff Properties.

It would help if you could post a clip of a few bars of what you want in the final output.
Registered user since 1996

Re: How do I make a script to effect only certain notes?

Reply #3
G'day medman28037,
Firstly, welcome to the forum.  Now, this is an easy one, believe it or not.

When you installed the user tool starter kit, it included a tool called "Global Mod" and another called "Variable Dump"

Global Mod is, well, global...  It can be used to do a vast array of tasks, and the Variable Dump tool is useful to determine the parameters you need for Global Mod if you are unfamiliar with things.

Now, take your middle C example:
We need to determine how they need to end up.
A Variable Dump of a red C is:
Code: [Select · Download]
NWC2ClipItem Object
(
    [ObjType] => Note
    [Opts] => Array
        (
            [Dur] => Array
                (
                    [4th] =>
                )
            [Pos] => -6
            [Color] => 1
        )
)


This tells us all we need to tell Global Mod how to make all the middle C's red.

Global Mod syntax wants to know what the object type is, selection criteria to narrow things down and what changes to make.

From the Variable Dump, we know the object type is a "Note", and the most important selection criteria is it's "Pos" which is -6 (the middle line of a staff is Pos==0) and finally we want the note to be red.  Because my variable dump was a red note, then the Color parameter is correct (NB colours are from the highlight colours).

So, global mod paramters:
Note,Pos==-6 Color=1

Note that there is an important space between "-6" and "Color"

There is more information on Global Mod within the script, simply invoke it with a "help" parameter.  This is the default invocation.  If you want to know more abot tool invocations then have a look at http://nwc-scriptorium.org/nwc2scripts/generaldiscussion.pdf and my "Invocation Instructions" http://nwc-scriptorium.org/nwc2scripts/invocationinstructions.pdf
I plays 'Bones, crumpets, coronets, floosgals, youfonymums 'n tubies.

Re: How do I make a script to effect only certain notes?

Reply #4
To add to Lawrie's response, if you start with:
Quote
!NoteWorthyComposerClip(2.0,Single)
|Note|Dur:4th|Pos:-6|Visibility:Never
|Note|Dur:4th|Pos:-5|Visibility:Never
|Note|Dur:4th|Pos:-4|Visibility:Never
|Note|Dur:4th|Pos:-5|Visibility:Never
|Bar
|Note|Dur:Whole|Pos:-6|Visibility:Never
!NoteWorthyComposerClip-End
and use GlobalMod with: Note,Pos==-6 Visibility=Default
The middle C's will become visible and all else will be unchanged.
Registered user since 1996

Re: How do I make a script to effect only certain notes?

Reply #5
If you have a good text editor, you can either modify a nwctxt file or data which have been cut to the clipboard. This is from an earlier thread.
Since 1998

Re: How do I make a script to effect only certain notes?

Reply #6
In handbell music, there are generally far more "chords" (and "rest-chords") than "notes".  While globalmod can change the color of isolated notes, it cannot possibly change the color of individiual notes within chords (and rest-chords).  The only attributes that NWC stores on a per-note basis within a chord are: accidental, pos (staff line), notehead, and tie.  Another problem with globalmod is that it will mark all C's (for example), even though some may be sharped or flatted (which are different bells).  In handbells, we don't care about the staff position, we just care about the final pitch.  A person with the "C#/Db" bell will want any B##, C#, or Db highlighted, even though these are all different positions in the staff (and yes, with key changes you may have to play that bell for two different staff positions).

My scripts all use the new getNoteMidiPitch interface, to ensure they give all notes for a particular bell, and no others.

Re: How do I make a script to effect only certain notes?

Reply #7
G'day Purdue
In handbell music, there are generally far more "chords" (and "rest-chords") than "notes".  While globalmod can change the color of isolated notes, it cannot possibly change the color of individiual notes within chords (and rest-chords).  The only attributes that NWC stores on a per-note basis within a chord are: accidental, pos (staff line), notehead, and tie. 
Chords could ONLY be handled by layering - NWC in incapable of colouring individual notes within a chord.

Quote
Another problem with globalmod is that it will mark all C's (for example), even though some may be sharped or flatted (which are different bells).
I beg to differ - the POS's are different (C, C#, Cb, Cnat, Cbb and Cx) :
Code: [Select · Download]
!NoteWorthyComposerClip(2.0,Single)
|Note|Dur:4th|Pos:-6
|Note|Dur:4th|Pos:#-6
|Note|Dur:4th|Pos:b-6
|Note|Dur:4th|Pos:n-6
|Note|Dur:4th|Pos:v-6
|Note|Dur:4th|Pos:x-6
!NoteWorthyComposerClip-End

Quote
In handbells, we don't care about the staff position, we just care about the final pitch.  A person with the "C#/Db" bell will want any B##, C#, or Db highlighted, even though these are all different positions in the staff (and yes, with key changes you may have to play that bell for two different staff positions).

My scripts all use the new getNoteMidiPitch interface, to ensure they give all notes for a particular bell, and no others.

This would require multiple applications of Global Mod, but it is not impossible - the new getNoteMidiPitch interface is not in the current release version of the starter kit, only the beta version.

The original problem was for children, how complex is that music likely to be?
I plays 'Bones, crumpets, coronets, floosgals, youfonymums 'n tubies.

Re: How do I make a script to effect only certain notes?

Reply #8
Hi Lawrie - I've watched you do battle with others on this forum, and now it's my turn I guess.  :-)

Quote
Chords could ONLY be handled by layering - NWC in incapable of colouring individual notes within a chord.
I believe this is exactly what I explained in both my previous posts.

Quote
I beg to differ - the POS's are different (C, C#, Cb, Cnat, Cbb and Cx)
My point here was that globalmod ignores the key signature, and ignores recurring accidentals within a bar.  If you use globalmod to mark all where pos==-6, you can get upwards of 5 different bells marked (Cbb [Bb], Cb [B ], C, C#, Cx [D]).  If you specify the particular C (e.g. pos==#-6), you'll get only the C sharps that are explicitly marked.  So you should have argued that one could "force accidentals" before the globalmod, and then "audit accidentals" afterward.  In between, up to 3 different globalmod commands would be needed, and all of this must be done on each staff (I typically need 4 staffs, 2 layered for each of treble/bass clefs, for handbells).

Quote
the new getNoteMidiPitch interface is not in the current release version of the starter kit, only the beta version.
This is why I was not offering my scripts yet, just gauging interest.  I actually have versions of my scripts that work without the new beta release, which I'd coded up before convincing Eric to add base support for this.

Quote
The original problem was for children, how complex is that music likely to be?
Just this morning I watched my sons (ages 13 and 9) and 5 other children play "Cradle Songs" at church - this song featured running eighth notes, multiple key changes, accidentals galore, and upwards of 8 bells playing simultaneously in chords. 

Re: How do I make a script to effect only certain notes?

Reply #9
G'day Purdue,
Hi Lawrie - I've watched you do battle with others on this forum, and now it's my turn I guess.  :-)
Well, I never intend it to be "battle" as such, but you certainly brought a smile to my morning :)

Quote
I believe this is exactly what I explained in both my previous posts.
Yeah, I was agreeing but in retrospect I didn't say it very well - sorry.

Quote
My point here was that globalmod ignores the key signature, and ignores recurring accidentals within a bar.  If you use globalmod to mark all where pos==-6, you can get upwards of 5 different bells marked (Cbb [Bb], Cb [B ], C, C#, Cx [D]).  If you specify the particular C (e.g. pos==#-6), you'll get only the C sharps that are explicitly marked.  So you should have argued that one could "force accidentals" before the globalmod, and then "audit accidentals" afterward.  In between, up to 3 different globalmod commands would be needed, and all of this must be done on each staff (I typically need 4 staffs, 2 layered for each of treble/bass clefs, for handbells).
This is true (ignoring the point that you that you wouldn't see double flats or double sharps in the key sig).  To extend that thought though, in the event you are wanting to create permanent invocations, you could "stack" commands (up to 254? or 255? - I forget which - characters) that would take all possible variants into account.  E.G:
Note,Pos==-6 Color=1 Note,Pos==#-7 Color=1 Note,Pos==v-5 Color=1 Note,Pos==n-6 Color=1

This would surely start to get complicated though, which makes your point about the getNoteMidiPitch interface all the more appropriate, once it gets into the release version of the starter kit.  For now, we have GlobalMod...

On the other hand, surely if the key signature specifies a certain sharp or flat then you would define the appropriate GlobalMod command to suit?  Notes with accidentals would remain black and be easy to spot.

Quote
This is why I was not offering my scripts yet, just gauging interest.  I actually have versions of my scripts that work without the new beta release, which I'd coded up before convincing Eric to add base support for this.
Just this morning I watched my sons (ages 13 and 9) and 5 other children play "Cradle Songs" at church - this song featured running eighth notes, multiple key changes, accidentals galore, and upwards of 8 bells playing simultaneously in chords. 
Impressive.  I withdraw my comment on complexity too.  After I had posted I thought about some of the incredibly complex playgroud games kids often play that require amazing co-ordination.  I am once again reminded that as an adult I tend to forget just how capable our kids can be if we but let them.

One thing I am curious about - we only have 7 highlight colours to choose from - is this enough?  After all, we have 12 tones and those in multiple octaves.  I confess I've never had anything to do with music for handbells so I am talking through my hat a bit here.

To take your "do battle" comment seriously for a moment.  Please let me assure you that battle is furthest from my mind.  I do not see these discussions as necessarily adversarial, but rather an opportunity to enlighten myself in those cases where I am either flat out wrong or at least have overlooked something and to bring enlightenment on those occasions when I do have it right.  I have no idea what the actual ratio is, but I'd settle for 50:50 ;)
I plays 'Bones, crumpets, coronets, floosgals, youfonymums 'n tubies.

Re: How do I make a script to effect only certain notes?

Reply #10
Doing battle?  Lawrie's postings are never less than gentlemanly and considerate.  We would all do well to adopt his patience and excellent online manners.  Me in particular (grin).

Re: How do I make a script to effect only certain notes?

Reply #11
Hi Lawrie,

I truly only meant "battle" in a playful sense, hence the smiley face.  I've just seen many a spirited "conversation" started in this forum between 2 posters, once one replied by name to the other, quoting him and responding item by item.  :-)

I also did not mean to put down globalmod (or any other script).  I was just hoping to carve out my own little niche, of scripts dedicated to the specific situations that handbell players run into.

Quote
On the other hand, surely if the key signature specifies a certain sharp or flat then you would define the appropriate GlobalMod command to suit?  Notes with accidentals would remain black and be easy to spot.
An interesting (true-life) case comes to mind.  One piece had F# in the key signature for the first and last third, and Fnat in the middle.  There were then some Fnat accidentals in the first and last third, and some F# accidentals in the middle.  And one child was playing the F bell while a different child was playing the F# bell.  Good luck with globalmod here!

Quote
One thing I am curious about - we only have 7 highlight colours to choose from - is this enough?  After all, we have 12 tones and those in multiple octaves.  I confess I've never had anything to do with music for handbells so I am talking through my hat a bit here.
You actually need only 2 colors, one for each hand.  You make separate notations to yourself to swap bells for a hand, where necessary.  So one or more bells (notes) would be one color, and one or more would be the other color, with all other notes being the default color.  (In case you didn't realize, each handbell player often has his own copy of the score, color-coded for just the notes he's playing.  Advanced players might not need any highlighting, working off a plain score, and sometimes 2 players work off one copy, aiding in page turns.  Children pretty much always need some sort of highlighting to pick out their notes from a very cluttered score copy.)

More info, in case interested:  Handbell choirs typically span anywhere from 2 to 5 octaves, but not all semitones in that range occur in a given piece by any means.  A piece must be carved up, with each player taking a subset of bells that can be played - it's hard to play more than 2 bells at any one instant.  Sharing a bell during a piece is possible, but rare.  When handling more than 2 bells (other than simple key changes), bell changes often must be carefully choreographed.  For these and many other reasons, playing handbells is not so simple as ringing a bell!

 

Re: How do I make a script to effect only certain notes?

Reply #12
Handbell music appears to be quite complex.

If <this> is any indication, there seems to be a rich set of articulations.

Several examples at: http://www.hopepublishing.com/html/main.isx?sub=57&promo_date=Spring+2010&category=Handbell
That link is likely to expire soon. These may be more permanent:
http://www.hopepublishing.com/media/pdf/2511.pdf
http://www.hopepublishing.com/media/pdf/2515.pdf
http://www.hopepublishing.com/media/pdf/2512.pdf
http://www.hopepublishing.com/media/pdf/2501.pdf
http://www.hopepublishing.com/media/pdf/2506.pdf

As to examples of color coding, the best I could find is: http://www.rainbowbellmusic.com/

In any case, developing User Tools requires data. Several "before" and "after" scores would need to be produced for testing. A tool (or nwctxt utility) would need to know what bells were at each station that it was producing a "part score" for. This would argue for close cooperation between someone intimately familiar with bell choirs and someone who can script NoteWorthy.
Registered user since 1996

Re: How do I make a script to effect only certain notes?

Reply #13
G'day Purdue,
I'm sure I took it as intended - with much humour :)  Like I said, it quite brought a smile to my morning.

I like the example you related, but as I'm sure you realise, it could still be done simply by making selections prior to running a user tool.  While I'm quite demonstrably a fan of Global Mod I realise it does have it's limitations.  

How I would approach your example using GlobalMod would be either:
a) select the middle section, define a GlobalMod command to suit - similar to the example I gave above - run it and then "unselect" and run another GlobalMod command on the whole staff, but this time with the command modified to ignore notes that were already a different colour E.G. Note,Pos==-3,!Color Color=1
OR
b) Run a script over the whole staff and then select the middle section and run a corrective script - this means you don't need to worry about the ignore coloured notes step.

Neither are perfect, but it still beats doin' it by hand.

With only a 2 colour requirement how this would work is much clearer - thanks for the extra info.  It certainly means a lot of scores to prepare though - I imagine most players usually prepare their own copies with a highlighter or the like.

From the sound of things you have quite a number of tools you've produced for yourself - care to share?  I try to encourage others to contribute their user tools as it helps to expand the usefulness of NWC for all of us.
I plays 'Bones, crumpets, coronets, floosgals, youfonymums 'n tubies.

Re: How do I make a script to effect only certain notes?

Reply #14
Quote
Handbell music appears to be quite complex.
Yes it is.  I was hoping to find other handbell players via this thread, to discuss using NWC to notate handbell music, and to control it on playback.

Quote
In any case, developing User Tools requires data. Several "before" and "after" scores would need to be produced for testing. A tool (or nwctxt utility) would need to know what bells were at each station that it was producing a "part score" for. This would argue for close cooperation between someone intimately familiar with bell choirs and someone who can script NoteWort
With my "highlight notes" tool, I just open a copy of the score, and run the user tool on each staff, with a command line like this for example:  "C4 E4 A5 B5 Ab5 Bb5".  (This was the set of bells I had in a recent piece.)  I can easily repeat that particular user tool invocation on each staff (up to 4 needed, with layering on treble/bass) without reentering the bell set.  The I print it out, undo all the user tools, and I'm ready to repeat with a different bell set.  IMHO, this is far simpler and far "safer" then trying to use globalmod!

Quote
With only a 2 colour requirement how this would work is much clearer - thanks for the extra info.  It certainly means a lot of scores to prepare though - I imagine most players usually prepare their own copies with a highlighter or the like.
Yes, preparing a copy with 2 highlighters is the norm for children.  I was just trying to automate this.

Quote
From the sound of things you have quite a number of tools you've produced for yourself - care to share?  I try to encourage others to contribute their user tools as it helps to expand the usefulness of NWC for all of us.
I'm happy to share - I was just trying to see if there was any interest (and feedback) from other handbell players, before I took the time to "productize" them.

Re: How do I make a script to effect only certain notes?

Reply #15
Thank you everyone for your input.  I was playing around and was able to do what I needed with no problem.  I had to create a staff for each color, then set all the notes to visibility= never.  Then using y'all input with Global Mod made the notes I needed for that color visible.  I then layer the whole thing together and it worked pretty well.  I tweaked the glob mod phrase y'all recommending so I did not have to edit it for each note.  That helped alot.  Here is the phrase I used:
php\php.exe scripts\adp_GlobalMod.php Note,Pos==<PROMPT:Enter Note position:=*> Visibility=<PROMPT:Set Visibility to:=|Default|Always|TopStaff|Never|>
Thanks again for all the help