Skip to main content
Topic: Change Clef (Read 15476 times) previous topic - next topic

Change Clef

This tool changes the clef, moving all notes and chords up or down appropriately.
Update 18/02-2015 : new version :
 - correction of a bug (inserting clef after selection); this involved change of input type ('Clip Text' ==> 'File Text')
 - rewritten in script language Lua ==> change of installation instructions

Installation instructions:
- Download and save the file in YourScriptsFolder and change the extention' txt' to 'js'.
- Open a NoteWorthy File
- Choose ‘Tools’, ‘User Tool…’ or enter Alt-F8
- Click ‘New…’
- Enter the name of the tool and choose a group or enter the name of a new group
- Command Line: "Wscript YourScriptsFolder\ChangeClef.js <PROMPT:New Clef:=|Treble|Bass> <PROMPT:Octave Shift:=|None|Octave_Up|Octave_Down> <PROMPT:Execution Mode:=|Modify|Show|Help>"

- Drag and drop the downloaded file upon the NWC window and click "Yes" on the pop up window "Please Confirm"
- Click "Edit" in the window "User Tools"
- Choose Input Type: Clip Text
- Under 'Options: Uncheck 'Returns File Text'

Any comments are welcome.

P.S. You can find this and other tools also on my website http://opagust.wordpress.com
Always look on the bright side of life!


Re: Change Clef

Reply #2
Just a note:
Bryan Creer posted a "Clef Change" php some years ago, which includes (if I remember correctly) Tenor and Alto clefs, with option of octave up / down.

The scores we use for the songs of our choir only have Treble and Bass clefs. For the other clefs, I didn't know the exact position. After a look into the script of Bryan Creer, I could modify mine to include also Tenor, Alto and Percussion.

The result is that there are two tools now that do exactly the same. The difference lies in the script language. (PHP seems to me a little obscure, so I prefer Java Script.)
In attachment you find the new version. (Don't forget to change the extension 'txt' to 'js')

New Command Line : "Wscript YourScriptsFolder\ChangeClef.js <PROMPT:New Clef:=|Treble|Bass|Tenor|Alto|Percussion> <PROMPT:Octave Shift:=|None|Octave_Up|Octave_Down> <PROMPT:Execution Mode:=|Modify|Show|Help>"
Always look on the bright side of life!

Re: Change Clef

Reply #3
I enclosed a new version of ChangeClef.js, with corrected handling of accidentals, chords with "pos2" and option "Stem" in Restchords.

P.S. Don't forget to change the extension to "js" after downloading.
Always look on the bright side of life!

Re: Change Clef

Reply #4
I discovered and corrected 2 typos ('optarry' and 'optary' instead of 'optarray' in function GetOpt).
Always look on the bright side of life!

Re: Change Clef

Reply #5
Just tried it out.  This is what went in:
Code: (nwc) [Select · Download]
!NoteWorthyComposerClip(2.51,Single)
|Note|Dur:16th|Pos:0|Opts:Stem=Up,Beam=First
|Note|Dur:16th|Pos:1|Opts:Stem=Up,Beam
|Note|Dur:16th|Pos:2|Opts:Stem=Up,Beam
|Note|Dur:16th|Pos:5|Opts:Stem=Up,Beam=End
|Note|Dur:16th|Pos:-1|Opts:Stem=Up,Beam=First
|Note|Dur:16th|Pos:0|Opts:Stem=Up,Beam
|Note|Dur:16th|Pos:1|Opts:Stem=Up,Beam
|Note|Dur:16th|Pos:4|Opts:Stem=Up,Beam=End
|Chord|Dur:8th|Pos:-2,1,#3|Opts:Stem=Up|Dur2:8th|Pos2:-9,-6,#-4
|Rest|Dur:8th|Opts:Stem=Down
|Chord|Dur:8th,Accent|Pos:-13,-6|Opts:Stem=Down|Dur2:8th|Pos2:1,8
|Rest|Dur:8th,Accent|Opts:Stem=Up
!NoteWorthyComposerClip-End

And what came out:

Code: (nwc) [Select · Download]
!NoteWorthyComposerClip(2.51,Single)
|Note|Dur:16th|Pos:-12|Opts:Stem=Up,Beam=First
|Note|Dur:16th|Pos:-11|Opts:Stem=Up,Beam
|Note|Dur:16th|Pos:-10|Opts:Stem=Up,Beam
|Note|Dur:16th|Pos:-7|Opts:Stem=Up,Beam=End
|Note|Dur:16th|Pos:-13|Opts:Stem=Up,Beam=First
|Note|Dur:16th|Pos:-12|Opts:Stem=Up,Beam
|Note|Dur:16th|Pos:-11|Opts:Stem=Up,Beam
|Note|Dur:16th|Pos:-8|Opts:Stem=Up,Beam=End
|Text|Text:"\}Chord\}Dur:8th\}Pos: ..."|Font:StaffBold|Pos:8|Wide:Y
|Rest|Dur:8th|Opts:Stem=Down
|Chord|Dur:8th,Accent|Pos:-25,-18|Opts:Stem=Down|Dur2:8th|Pos2:-11,-4
|Rest|Dur:8th,Accent|Opts:Stem=Up
!NoteWorthyComposerClip-End

Thanks for submitting it, it looks useful.  Any plans to add other clefs?
I haven't studied your code, but it seems other clefs could be added easily.  Each one has an offset from middle C so the difference between clef offsets plus or minus any octave shift would give the Pos: change for all other objects.
Since 1998

Re: Change Clef

Reply #6
Quote
I haven't studied your code, but it seems other clefs could be added easily.

Warren, did you use my latest version? It handles Treble, Bass, Tenor, Alto and Percussion. That are all the clefs I know of.
In addition, my first version didn't handle notes and chords with accidentals correctly, which is showed in your outputclip.
Always look on the bright side of life!

Re: Change Clef

Reply #7
I wasn't using the latest version.  You might want to consider editing earlier posts to remove pervious versions.  Anytime someone visits your thread, they can only get the L & G version (latest and greatest) when you remove and replace attachments or use some other method.
Since 1998

Re: Change Clef

Reply #8
You might want to consider editing earlier posts to remove pervious versions.  Anytime someone visits your thread, they can only get the L & G version (latest and greatest) when you remove and replace attachments or use some other method.

Point taken.
Always look on the bright side of life!

Re: Change Clef

Reply #9
Update 18/02-2015 : new version :
 - correction of a bug (inserting clef after selection); this involved change of input type ('Clip Text' ==> 'File Text')
 - rewritten in script language Lua ==> change of installation instructions

See original message in this topic
Always look on the bright side of life!

 

Re: Change Clef

Reply #10
Hi Opagust

I have been trying out your change clef tool, but I am having difficulty with getting the octave up command to work. If I try, it immediately gives me an error message.

Re: Change Clef

Reply #11
Hi Opagust

I have been trying out your change clef tool, but I am having difficulty with getting the octave up command to work. If I try, it immediately gives me an error message.
Hi SEBC,
What is the error message?
Always look on the bright side of life!