Skip to main content
Topic: Easy Search-Replace for 1 shape in a 7-shape shape-note score? (Read 4010 times) previous topic - next topic

Easy Search-Replace for 1 shape in a 7-shape shape-note score?

I use the tool for replacing the standard noteheads with shape notes A LOT lately in my current project.  However, I would like to keep the standard notehead for shape 5 (SO, or SOL).  The tilted oval shape is wider, with thicker lines along the flattened "sides," more aesthetic, and distincter than the small faint circular shape rendered by the user tool.  I want to keep the clefs and other symbols in the standard notation typeface (nwc2stada) as well.  So, I've been running the shape note tool, then manually replacing all the shape 5 noteheads.  It is a wearisome process and I'm afraid I will overlook some notes.

How would I go about creating a tool to replace all instances of one shape (shape 5) with the standard shape noteheads?  This is possible, yes?

At some point in the future, I would also like to make alterations to all of those 7-shape noteheads, (as well as to other symbols such as the "flags" for eighth, sixteenth notes, etc.)  but I believe I recall reading somewhere in the forum that those shapes aren't produced like other fonts and a font editor would not be of use?

***The line thickness of the shaped noteheads in the NWC2MusikDingsSans metric is actually what would be satisfying for my present need, but only with the standard notehead shape substituted for SOL (shape 5), while at the same time keeping the NWC2STADA clefs, time sigs and other accompanying symbols.  Wish there were options for mix and match along this line.  There are parts I want to use from one set, without giving up what is best found in another.

Are there any users knowlegable in this area that can point me to resources for creating a new set of symbols, or symbol fonts that the noteworthy program can be made to recognize?

Re: Easy Search-Replace for 1 shape in a 7-shape shape-note score?

Reply #1
At some point in the future, I would also like to make alterations to all of those 7-shape noteheads, (as well as to other symbols such as the "flags" for eighth, sixteenth notes, etc.)  but I believe I recall reading somewhere in the forum that those shapes aren't produced like other fonts and a font editor would not be of use?
I'm not sure where you read this, but I don't believe that statement is correct. When you click on the "Char Map..." button in the Insert Text function (with Staff Symbols as the chosen font), you can see the various open and closed versions of the shape noteheads. You can also see the various flags. The fact that you noticed that there are slightly different shapes for those noteheads in the NWCMusicDingsSans font shows that these characters CAN be customized using a font editor.

If you want to know how to create a new custom font for NWC, I would guess that @Lawrie Pardy (who created the MusicDings and SwingDings fonts) would be a good starting place.

One other final note (I think it's a "SOL" :) ) to consider. User tools are not difficult to create or change, and it should be fairly straightforward to modify the user tool you are using to replace shape noteheads so that it uses a standard notehead for SOL. Are you running the tool named "Shape Notes (nwsw)" (which comes with the starter pack)? If so, let me know and I'll see if I can create a version of that tool that would do what you are looking for.

Re: Easy Search-Replace for 1 shape in a 7-shape shape-note score?

Reply #2
I created this a number of years ago, don't know if it will fly or not.
Code: [Select · Download]
/*
 unShape.js  by Warren Porter


                                  Un-shape Tool
 This tool will remove the shape attribute

 This tool can operate on ONLY a selected part of a staff, or, if nothing has been selected, the entire staff.

 To install:
 1) Save this file with the name unShape.js on your computer and remember its location.
 2) Start NWC and press Alt/F8.  Pick new
 3) After choosing a name and group, browse for this file and click "Open".
 4) Insert "wscript " at the beginning of the command.
 5) Clip text should be selected and check no options.
 */

rc=0, errMsg="";

function doProcess(clip) {
var displ=0, upDispl=0;
var result = new Array();
var lines = clip.split("\r\n");
  for (i = 1; i < lines.length; i++) {           // Main processing loop
  if (/Fake/.test(lines[i]))
    lines[i] = "#";
  else {
    result = lines[i].match(/(\|Note.*Pos:)([n#bvx]?)(-?\d+)([a-h])(\^?)(.*)$/) // 1. Note thru Pos 2. Accidental 3. Position 4. Shape 5. Ties 6. To end of line
if (result != null) {
  lines[i] = result[1] + result[2] + result[3] + result[5] + result[6] }
   } }    // End main loop
  return lines;
}

var myLines;
  myLines=doProcess(WScript.StdIn.ReadAll()).join("\r\n");

if (rc == 0)
  WScript.StdOut.Write(myLines);
else
  WScript.StdErr.Write(errMsg);
WScript.quit(rc);

Save it as unShape.js and follow installation steps at the top.
Since 1998

 

Re: Easy Search-Replace for 1 shape in a 7-shape shape-note score?

Reply #3
I've always understood it to be SOL as well, but read recently that for pronunciation sake schools that use the fasola teaching method are now dropping the "L." 

Anyway, I used the insert text functiion/char map and can see the shapes.... (the microsoft font viewer didn't show me down that far in the list) so it does appear editable.

Just peeked into the nwsw_ShapeNotes.php file using notepad and I noticed this little thing:

"/skip=<PROMPT:Skip:=*xXzy>"
   Defines the existing note heads that should be ignored during shape assignment

I don't understand PHP and the usage is unclear to me, but it would appear I should be able to convert standard to shape noteheads and make the tool just leave off converting one of the notes.  Am I reading that correctly?  If so, that might simplify things a great deal to just leave SOL out of the conversion altogether.

Re: Easy Search-Replace for 1 shape in a 7-shape shape-note score?

Reply #4
I don't understand PHP and the usage is unclear to me, but it would appear I should be able to convert standard to shape noteheads and make the tool just leave off converting one of the notes.  Am I reading that correctly?  If so, that might simplify things a great deal to just leave SOL out of the conversion altogether.
Down around line 40 you will see this:
Code: (php) [Select · Download]
$AllShapeNotes = array("4-shape" => "dfgdfgc", "7-shape" => "abcdfgh");
I suggest a change to:
Code: (php) [Select · Download]
$AllShapeNotes = array("4-shape" => "dogdogc", "7-shape" => "abcdogh");
Since you have been brave enough to look at the code, this should not be too shocking  :)
Registered user since 1996

Re: Easy Search-Replace for 1 shape in a 7-shape shape-note score?

Reply #5
That is more efficient than the "brute force" change that I mocked up here. (I didn't realize that the "o" note shape had the same effect as a blank one).

Rick's change will make the tool always leave "sol" notes unchanged. One could instead add another item to the $AllShapeNotes array,  called "7-shape-no-sol" for example, so that the user can choose either behavior. (The command line options would also need to be updated to allow the addition prompt drop down).

Re: Easy Search-Replace for 1 shape in a 7-shape shape-note score?

Reply #6
Thanks!!!  I tried a little trial-and-error with the command line, which didn't work out too well.

Did what you suggested, which perfectly addressed the main issue that was perplexing me. 

I have noticed that where there are courtesy accidentals, the script turns those notes into ties in the conversion process.  Maybe there is a place on here to submit suggestions for fixes, but I've lost track of it if there was.


Down around line 40 you will see this:
Code: (php) [Select · Download]
$AllShapeNotes = array("4-shape" => "dfgdfgc", "7-shape" => "abcdfgh");
I suggest a change to:
Code: (php) [Select · Download]
$AllShapeNotes = array("4-shape" => "dogdogc", "7-shape" => "abcdogh");
Since you have been brave enough to look at the code, this should not be too shocking  :)


Re: Easy Search-Replace for 1 shape in a 7-shape shape-note score?

Reply #7
I have noticed that where there are courtesy accidentals, the script turns those notes into ties in the conversion process.  Maybe there is a place on here to submit suggestions for fixes, but I've lost track of it if there was.
Since courtesy accidentals are a new feature added since the user tool was written, it's not a surprise that the tool is misinterpreting them. The user tool was written by @NoteWorthy Online so hopefully by tagging him here, he will see this thread and be aware that a fix is needed.

Re: Easy Search-Replace for 1 shape in a 7-shape shape-note score?

Reply #8
In a way, I kinda did make an option to revert back.  In case I botched it, I copied the php tool to another folder, edited it, and renamed it to "nwsw_ShapeNotesSkipSOL.php."  Then copied it back to the script folder and made a new command/link to run it.  If I'd run into problems, I still had a backup.  But, it worked out so I have either as an option now.

That is more efficient than the "brute force" change that I mocked up here. (I didn't realize that the "o" note shape had the same effect as a blank one).

Rick's change will make the tool always leave "sol" notes unchanged. One could instead add another item to the $AllShapeNotes array,  called "7-shape-no-sol" for example, so that the user can choose either behavior. (The command line options would also need to be updated to allow the addition prompt drop down).