Skip to main content
Topic: Resting Staff (Read 6680 times) previous topic - next topic

Resting Staff

This tool should come in handy when you decide, after many time signature, key signature, and/or clef changes that it will be necessary to layer the staff you are working on.
  • Create your new staff.
  • Copy the original staff to the new one.
  • Run this tool: "Resting Staff".  The new staff will have all notes, chords, and rests replaced with whole notes rests! except for pickups.
  • Replace appropriate measures when necessary to layer parts from the original staff.
  • Be sure the instrument and dynamic level match the original staff.
  • Run the MMR tool with the "LayerHide" option.
This tool also helps edits bar lines.  Any measure with too many or few beats will be replaced with rests with the same duration instead of a whole rest.

To install, save this code on your computer with a name of restStaff.js and note its location.
While NWC has a file opened, enter Alt/F8 for User Tools.  Select New and choose a group and a name.
Click Browse and find the file you just saved and click Open.
Insert "wscript " (note trailing space) in the beginning of the Command line.
Click OK and it is ready to run.  There are no prompts.

This will change your staff to rests.  Before using, save your file and duplicate the staff on which you will be using it.
Code: [Select · Download]
/* Notes to Rests by Warren Porter "restStaff.js"
   After downloading this file, when setting it up in NWC User Tools create this command line:

   wscript "'Browse can insert the path for you' \restStaff.js"

   This can help create a new staff when one is needed for layering.  First, copy an entire staff to the clipboard, create a new staff,
   then cut the clipboard to the new staff.  Run this command on that new staff.  Clefs, time signatures, and key signatures will be
   left alone on the new staff, but all notes, chords, and restchords will be replaced by rests.  Bars with "full measures" (the norm,
   it has as many beats as the time signature dictates) will be replaced with whole rests, a measure with more or fewer (like a pickup)
   will be replaced with rests of the same durations (and order if necessary) or the original notes, rests, chords, or restchords.

   The new staff may then be used for layered notes for the original staff.  It can be run through the MMR tool with the "LayerHide"
   option so unneeded parts won't display.
  
   This is not suited to creating a "tempo" or "conductor" staff.  To create a tempo staff which could be layered into all other parts
   to print parts, the clef or keys should not be copied while tempos or tempo variences should be.
 */

var rc=0, errMsg=""
function getNoteLength(notelet) {  // Returns duration of note , whole = 768
var NoteLengths = { "16th":48, "32nd":24, "4th":192, "64th":12, "8th":96, "Half":384, "Whole":768 }
parts = notelet.split(",");
var  noteLength= -1;
noteLength = NoteLengths[parts[0]];
var noteLength = ( NoteLengths[parts[0]] === undefined ) ? -1 : NoteLengths[parts[0]];
  if (noteLength == -1)
    return -1;

  for (var i = 1; i < parts.length; i++) {
    if (parts[i].substr(0,9) == "DblDotted") {
  noteLength = noteLength * 7 / 4; }
else
      if (parts[i].substr(0,6) == "Dotted") {
    noteLength = noteLength * 3 / 2; }
  else
    if (parts[i].substr(0,7) == "Triplet") {
      noteLength = noteLength * 2 / 3; } }
  return noteLength;
}
function calculate(clip) {
  var i, j=0, dsi;
  var lines = new Array(), result = new Array(), nlines = new Array, mt=0, measureTab = new Array, beatletCount=0, targetMeasure = 768;
  var thisDur, thisNote, durSplit;
  lines = clip.split("\r\n");
  for (i=0; i < lines.length; i++) {
if (lines[i].slice(1,5) == "Text" || lines[i].slice(1,14) == "TempoVariance")
  continue;
    if (lines[i].slice(1,5) == "Fake" || lines[i].slice(1,8) == "Context" ) {  // For these items, pass them thru and ignore them.
  nlines[j++] = lines[i]; continue; }
if (lines[i].slice(1,8) == "TimeSig") {
  if (beatletCount == targetMeasure)  // Measure exactly full
    nlines[j++] = "|Rest|Dur:Whole|Visibility:Never";  // Insert whole rest
  else {
    for (mt = 0; mt < measureTab.length; mt++)
  nlines[j++] = "|Rest|Dur:" + measureTab[mt] + "|Visibility:Never";}
  beatletCount = 0, measureTab.length = 0; mt=0;
  result = lines[i].match(/ture:(\d+)\/(\d+)/);  // Read the time signature
  if (result == null)  //In case it is C or cut time
    targetMeasure = 768;
  else
    targetMeasure = 768 * result[1] / result[2];    // Calculate length of measure  
  nlines[j++] = lines[i]; continue; }  
if (/Grace/.test(lines[i]))
  continue;
result = lines[i].match(/Dur:([^\|\r\n]+)/)   // Looking for anything with a duration
if (result != null) {  // Duration loop
  thisDur = result[1];
  thisNote = getNoteLength(thisDur);
  if (thisNote == -1) {
    errMsg += "Invalid duration of " + lines[i] + "\r\n";
rc=1;
continue; }
  durSplit = thisDur.split(",");
  for (dsi=1; dsi < durSplit.length; dsi++)
    if (!(durSplit[dsi].substr(0,9) == "DblDotted" || durSplit[dsi].substr(0,6) == "Dotted" || durSplit[dsi].substr(0,7) == "Triplet")) {
  durSplit.length = dsi; break; }
  measureTab[mt++] = durSplit.join(",");
  if (lines[i].slice(1,15) == "Rest|Dur:Whole")  //So existing whole rest in , e.g., 3/4 time won't be treated as having 4 beats.
    thisNote = targetMeasure;
  beatletCount += thisNote;
  continue; }   // End duration loop
if (lines[i].slice(1,4) == "Bar" || lines[i].slice(1,5) == "Flow" || lines[i].slice(1,7) == "Ending"  || lines[i].slice(0,1) == "!"||
      lines[i].slice(1,13) == "RestMultiBar" || lines[i].slice(1,9) == "Boundary" || lines[i].slice(1,11) == "Instrument" ||
  lines[i].slice(1,4) == "MPC" || lines[i].slice(1,5) == "Clef" || lines[i].slice(1,4) == "Key" ) {  //Bar loop, flow, & spec. endings
  if (beatletCount == targetMeasure)  // Measure exactly full
    nlines[j++] = "|Rest|Dur:Whole|Visibility:Never";  // Insert whole rest
  else {
    for (mt = 0; mt < measureTab.length; mt++)
  nlines[j++] = "|Rest|Dur:" + measureTab[mt] + "|Visibility:Never";}
  beatletCount = 0, measureTab.length = 0; mt=0;  // Get set up for next measure
  if (lines[i].slice(1,6) != "Tempo")
    nlines[j++] = lines[i]; }  //End bar loop
  }  //End main processing loop
  return nlines;
}

var myLines=calculate(WScript.StdIn.ReadAll()).join("\r\n");
if (rc == 0)
  WScript.StdOut.Write(myLines);
else
  WScript.StdErr.Write(errMsg);
WScript.quit(rc);

Modified to include special endings and flow control the same as bar lines.
Allow whole rest in non 4/4 (2/2) time to assume the value of time signature then in effect.
Hides generated rests.  Will not copy tempos or tempo variences.
Passes through MMRs, Boundarys, MPC, and Instrument changes.
Since 1998


Re: Resting Staff

Reply #2
I think I may have beaten you to this one ;-)
https://forum.noteworthycomposer.com/?topic=7918.0 reply #7
But I can't find my original post:-(
Probably have--I haven't been writing tools for very long--will take a look at it.

Concerning the other thread: I had thought this tool would be helpful for a creating tempo or conductor staff to layer into everyone's part one at a time, but for that it needs to discard clefs and keys.  I'll consider a version to ignore those on request after adding a prompt.

David P caught the note instead of rest on the 3rd bullet of my original post.
Since 1998

Re: Resting Staff

Reply #3
I think I may have beaten you to this one ;-)
As did I:
A side use is to add no text or key. This will result in a staff with just invisble rests and barlines.
It drew no replies so I've never posted an update to remove the Vertical Offset. The offset has been unneeded since NWC added Viewer Mode.
Registered user since 1996

 

Re: Resting Staff

Reply #4
For this tool I focus on a layered staff for one instrument.  To create a tempo staff, clefs and keys should be removed from the staff while texts, tempos and tempo variences should maintained with appropriate rests on either side of them if need be.  I'll save that for a separate tool

Generated rests are hidden in this version.

The attached test file shows what happens if there aren't as many beats in a measure as their are supposed to be.  In the second unfilled measure, the middle beamed notes need to have their durations doubled.  Also, in 3/4 time, a whole rest and dotted half rest are treated the same.

The first post reflects the above changes.
Since 1998

Re: Resting Staff

Reply #5
Another useful tool, thanks Warren!
Two observations:

- The tool treats a MMR as 1 measure so the resulting staff is shortened.

Before:
Code: (nwc) [Select · Download]
!NoteWorthyComposerClip(2.5,Single)
|Boundary|Style:Collapse
|Clef|Type:Treble|OctaveShift:Octave Down|Visibility:Always
|Key|Signature:F#|Tonic:C
|TimeSig|Signature:4/4
|Tempo|Tempo:126|Text:"Lively"|Pos:11
|RestMultiBar|NumBars:9|PrintOnce:Y|WhenHidden:ShowBars,ShowRests
|Dynamic|Style:p|Opts:Volume=34|Pos:9|Visibility:Never
|Bar
|Boundary|Style:EndCollapse
|Note|Dur:Half|Pos:-2
|Rest|Dur:Half
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Half
|Rest|Dur:4th
|Rest|Dur:8th
|Dynamic|Style:mf|Opts:Volume=57|Pos:9|Justify:Right
|Note|Dur:8th|Pos:-2
|Bar
|Note|Dur:8th|Pos:-1|Opts:Stem=Up,Beam=First
|Note|Dur:8th|Pos:-2|Opts:Stem=Up,Beam
|Note|Dur:8th|Pos:-1|Opts:Stem=Up,Beam
|Note|Dur:8th|Pos:-2|Opts:Stem=Up,Beam=End
|Note|Dur:8th|Pos:-1|Opts:Stem=Up,Beam=First
|Note|Dur:8th|Pos:-1|Opts:Stem=Up,Beam=End
|Rest|Dur:8th
|Note|Dur:8th|Pos:-2
|Bar
|Note|Dur:Half,Dotted|Pos:-5
|Rest|Dur:4th
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Half
|Rest|Dur:8th
|Note|Dur:8th|Pos:3
|Note|Dur:8th|Pos:b3|Opts:Stem=Down,Beam=First
|Note|Dur:8th|Pos:2|Opts:Stem=Down,Beam=End
|Bar
|Note|Dur:8th|Pos:#1
|Note|Dur:8th|Pos:1
|Note|Dur:8th|Pos:1
|Note|Dur:8th|Pos:1
|Note|Dur:8th|Pos:1|Opts:Stem=Down
|Note|Dur:8th|Pos:1|Opts:Stem=Down
|Note|Dur:8th|Pos:1|Opts:Stem=Down
|Note|Dur:8th|Pos:1|Opts:Stem=Down
|Bar
|Note|Dur:4th|Pos:n1
|Note|Dur:4th|Pos:1
|Note|Dur:8th|Pos:1
|Rest|Dur:8th
|Rest|Dur:4th
|Bar
|Dynamic|Style:mf|Opts:Volume=57|Pos:9|Justify:Right
|Note|Dur:4th|Pos:-2
|Note|Dur:8th|Pos:-1|Opts:Stem=Up,Beam=First
|Note|Dur:8th|Pos:-1|Opts:Stem=Up,Beam=End
|Note|Dur:8th|Pos:0|Opts:Stem=Up,Beam=First
|Note|Dur:8th|Pos:0|Opts:Stem=Up,Beam
|Note|Dur:8th|Pos:-2|Opts:Stem=Up,Beam
|Note|Dur:8th|Pos:-2|Opts:Stem=Up,Beam=End
|Bar
|Rest|Dur:8th
|Note|Dur:4th|Pos:2
|Note|Dur:8th|Pos:0
|Note|Dur:8th|Pos:0|Opts:Stem=Down,Beam=First
|Note|Dur:8th|Pos:0|Opts:Stem=Down,Beam
|Note|Dur:8th|Pos:0|Opts:Stem=Down,Beam
|Note|Dur:8th|Pos:0|Opts:Stem=Down,Beam=End
|Bar
|Note|Dur:4th|Pos:1
|Note|Dur:8th|Pos:1|Opts:Stem=Down,Beam=First
|Note|Dur:8th|Pos:1|Opts:Stem=Down,Beam=End
|Note|Dur:8th|Pos:1|Opts:Stem=Down,Beam=First
|Note|Dur:8th|Pos:1|Opts:Stem=Down,Beam
|Note|Dur:8th|Pos:1|Opts:Stem=Down,Beam
|Note|Dur:8th|Pos:1|Opts:Stem=Down,Beam=End
|Bar
|Note|Dur:Half|Pos:0|Opts:Stem=Down
|Rest|Dur:8th
|Note|Dur:8th|Pos:0
|Note|Dur:8th|Pos:1|Opts:Stem=Down,Beam=First
|Note|Dur:8th|Pos:0|Opts:Stem=Down,Beam=End
|Bar
|Note|Dur:8th|Pos:2|Opts:Stem=Down,Crescendo,Beam=First
|Note|Dur:8th|Pos:2|Opts:Stem=Down,Crescendo,Beam=End
|Rest|Dur:8th|Opts:Crescendo
|Note|Dur:8th|Pos:2|Opts:Crescendo
|Note|Dur:8th|Pos:2|Opts:Stem=Down,Crescendo,Beam=First
|Note|Dur:8th|Pos:2|Opts:Stem=Down,Crescendo,Beam
|Note|Dur:8th|Pos:3|Opts:Stem=Down,Crescendo,Beam
|Note|Dur:8th|Pos:2|Opts:Stem=Down,Crescendo,Beam=End
|Bar
|Rest|Dur:8th|Opts:Crescendo
|Note|Dur:8th|Pos:0|Opts:Crescendo
|Note|Dur:4th|Pos:2|Opts:Crescendo
|Note|Dur:8th|Pos:1|Opts:Stem=Down,Crescendo,Beam=First
|Note|Dur:8th|Pos:0|Opts:Stem=Down,Crescendo,Beam
|Note|Dur:8th|Pos:b3|Opts:Stem=Down,Crescendo,Beam
|Note|Dur:8th|Pos:2|Opts:Stem=Down,Crescendo,Beam=End
|Bar
|Note|Dur:8th|Pos:#1|Opts:Stem=Down,Crescendo,Beam=First
|Note|Dur:8th|Pos:1|Opts:Stem=Down,Crescendo,Beam=End
|Rest|Dur:4th|Opts:Crescendo
|Note|Dur:8th|Pos:1|Opts:Stem=Down,Crescendo,Beam=First
|Note|Dur:8th|Pos:1|Opts:Stem=Down,Crescendo,Beam=End
|Rest|Dur:4th|Opts:Crescendo
|Bar
|Note|Dur:8th|Pos:#1|Opts:Stem=Down,Crescendo,Beam=First
|Note|Dur:8th|Pos:1|Opts:Stem=Down,Crescendo,Beam=End
|Rest|Dur:4th|Opts:Crescendo
|Note|Dur:8th|Pos:1|Opts:Stem=Down,Crescendo,Beam=First
|Note|Dur:8th|Pos:1|Opts:Stem=Down,Crescendo,Beam=End
|Rest|Dur:4th|Opts:Crescendo
|Bar
|Note|Dur:8th|Pos:n1|Opts:Stem=Down,Crescendo,Beam=First
|Note|Dur:8th|Pos:1|Opts:Stem=Down,Crescendo,Beam=End
|Rest|Dur:4th|Opts:Crescendo
|Note|Dur:8th|Pos:1|Opts:Stem=Down,Crescendo,Beam=First
|Note|Dur:8th|Pos:1|Opts:Stem=Down,Crescendo,Beam=End
|Rest|Dur:4th|Opts:Crescendo
|Bar
|Note|Dur:8th|Pos:1|Opts:Stem=Down,Crescendo,Beam=First
|Note|Dur:8th|Pos:1|Opts:Stem=Down,Crescendo,Beam=End
|Note|Dur:4th|Pos:1|Opts:Crescendo
|Note|Dur:4th|Pos:1|Opts:Crescendo
|Chord|Dur:4th|Pos:2,4|Opts:Crescendo
|Bar
|Chord|Dur:Whole|Pos:2,5|Opts:Crescendo
|Bar
|Rest|Dur:Half
|Rest|Dur:8th
|Dynamic|Style:f|Opts:Volume=69|Pos:9|Justify:Right
|Note|Dur:8th|Pos:-6
|Note|Dur:8th|Pos:b-5|Opts:Stem=Up,Beam=First
|Note|Dur:8th|Pos:-6|Opts:Stem=Up,Beam=End
|Bar|Style:Double
|Key|Signature:Bb,Eb,Ab,Db|Tonic:C
|Note|Dur:4th|Pos:-4
|Note|Dur:8th|Pos:-4|Opts:Stem=Up,Beam=First
|Note|Dur:8th|Pos:-4|Opts:Stem=Up,Beam=End
|Note|Dur:8th|Pos:-4|Opts:Stem=Up,Beam=First
|Note|Dur:8th|Pos:-4|Opts:Stem=Up,Beam
|Note|Dur:8th|Pos:-3|Opts:Stem=Up,Beam
|Note|Dur:8th|Pos:-4|Opts:Stem=Up,Beam=End
|Bar
|Rest|Dur:8th
|Note|Dur:4th|Pos:1
|Note|Dur:8th|Pos:-1
|Note|Dur:8th|Pos:-3|Opts:Stem=Up,Beam=First
|Note|Dur:8th|Pos:-4|Opts:Stem=Up,Beam
|Note|Dur:8th|Pos:-3|Opts:Stem=Up,Beam
|Note|Dur:8th|Pos:-4|Opts:Stem=Up,Beam=End
|Bar
|Note|Dur:4th|Pos:2
|Note|Dur:8th|Pos:0|Opts:Stem=Up,Beam=First
|Note|Dur:8th|Pos:-2|Opts:Stem=Up,Beam=End
|Note|Dur:4th|Pos:-4
|Note|Dur:4th|Pos:0
|Bar
|Note|Dur:Half|Pos:-1
|Rest|Dur:8th
|Note|Dur:8th|Pos:-6
|Note|Dur:8th|Pos:-5|Opts:Stem=Up,Beam=First
|Note|Dur:8th|Pos:-6|Opts:Stem=Up,Beam=End
|Bar
|Note|Dur:4th|Pos:-4
|Note|Dur:8th|Pos:-4|Opts:Stem=Up,Beam=First
|Note|Dur:8th|Pos:-4|Opts:Stem=Up,Beam=End
|Note|Dur:8th|Pos:-4|Opts:Stem=Up,Beam=First
|Note|Dur:8th|Pos:-4|Opts:Stem=Up,Beam
|Note|Dur:8th|Pos:-3|Opts:Stem=Up,Beam
|Note|Dur:8th|Pos:-4|Opts:Stem=Up,Beam=End
|Bar
|Rest|Dur:8th
|Note|Dur:4th|Pos:1
|Note|Dur:8th|Pos:-1
|Note|Dur:8th|Pos:-3|Opts:Stem=Up,Beam=First
|Note|Dur:8th|Pos:-4|Opts:Stem=Up,Beam
|Note|Dur:8th|Pos:-3|Opts:Stem=Up,Beam
|Note|Dur:8th|Pos:-4|Opts:Stem=Up,Beam=End
|Bar
|Note|Dur:8th|Pos:0|Opts:Stem=Up,Beam=First
|Note|Dur:8th|Pos:1|Opts:Stem=Up,Beam
|Note|Dur:8th|Pos:2|Opts:Stem=Up,Beam
|Note|Dur:8th|Pos:0|Opts:Stem=Up,Beam=End
|Note|Dur:8th|Pos:-2|Opts:Stem=Up,Beam=First
|Note|Dur:8th|Pos:-4|Opts:Stem=Up,Beam
|Note|Dur:8th|Pos:-3|Opts:Stem=Up,Beam
|Note|Dur:8th|Pos:-4|Opts:Stem=Up,Beam=End
|Bar
|Note|Dur:Half|Pos:-1
|Rest|Dur:Half
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Half
|Rest|Dur:4th
|Rest|Dur:8th
|Note|Dur:8th|Pos:-1
|Bar
|Note|Dur:8th|Pos:0|Opts:Stem=Up,Beam=First
|Note|Dur:8th|Pos:-1|Opts:Stem=Up,Beam
|Note|Dur:8th|Pos:0|Opts:Stem=Up,Beam=End
|Note|Dur:8th|Pos:-1
|Note|Dur:8th|Pos:0|Opts:Stem=Down,Beam=First
|Note|Dur:8th|Pos:0|Opts:Stem=Down,Beam=End
|Rest|Dur:8th
|Note|Dur:8th|Pos:-1
|Bar
|Note|Dur:Half,Dotted|Pos:-4
|Rest|Dur:4th
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Half
|Rest|Dur:8th
|Note|Dur:8th|Pos:4
|Note|Dur:8th|Pos:n3|Opts:Stem=Down,Beam=First
|Note|Dur:8th|Pos:b3|Opts:Stem=Down,Beam=End
|Bar
|Note|Dur:8th|Pos:n2|Opts:Stem=Down,Beam=First
|Note|Dur:8th|Pos:2|Opts:Stem=Down,Beam
|Note|Dur:8th|Pos:2|Opts:Stem=Down,Beam
|Note|Dur:8th|Pos:2|Opts:Stem=Down,Beam=End
|Note|Dur:8th|Pos:2|Opts:Stem=Down,Beam=First
|Note|Dur:8th|Pos:2|Opts:Stem=Down,Beam
|Note|Dur:8th|Pos:2|Opts:Stem=Down,Beam
|Note|Dur:8th|Pos:2|Opts:Stem=Down,Beam=End
|Bar
|Note|Dur:4th|Pos:b2
|Note|Dur:4th|Pos:2
|Note|Dur:8th|Pos:2
|Rest|Dur:8th
|Rest|Dur:4th
|Bar
|Note|Dur:4th|Pos:-1
|Note|Dur:8th|Pos:0|Opts:Stem=Down,Beam=First
|Note|Dur:8th|Pos:0|Opts:Stem=Down,Beam=End
|Note|Dur:8th|Pos:1|Opts:Stem=Down,Beam=First
|Note|Dur:8th|Pos:1|Opts:Stem=Down,Beam
|Note|Dur:8th|Pos:-1|Opts:Stem=Down,Beam
|Note|Dur:8th|Pos:-1|Opts:Stem=Down,Beam=End
|Bar
|Rest|Dur:8th
|Note|Dur:4th|Pos:3
|Note|Dur:8th|Pos:1|Opts:Stem=Down,Beam=First
|Note|Dur:8th|Pos:1|Opts:Stem=Down,Beam
|Note|Dur:8th|Pos:1|Opts:Stem=Down,Beam
|Note|Dur:8th|Pos:1|Opts:Stem=Down,Beam
|Note|Dur:8th|Pos:1|Opts:Stem=Down,Beam=End
|Bar
|Note|Dur:4th|Pos:2
|Note|Dur:8th|Pos:2|Opts:Stem=Down,Beam=First
|Note|Dur:8th|Pos:2|Opts:Stem=Down,Beam=End
|Note|Dur:8th|Pos:2|Opts:Stem=Down,Beam=First
|Note|Dur:8th|Pos:2|Opts:Stem=Down,Beam
|Note|Dur:8th|Pos:2|Opts:Stem=Down,Beam
|Note|Dur:8th|Pos:2|Opts:Stem=Down,Beam=End
|Bar
|Note|Dur:Half|Pos:1
|Rest|Dur:8th
|Note|Dur:8th|Pos:1
|Note|Dur:8th|Pos:2|Opts:Stem=Down,Beam=First
|Note|Dur:8th|Pos:1|Opts:Stem=Down,Beam=End
|Bar
|Note|Dur:8th|Pos:3|Opts:Stem=Down,Beam=First
|Note|Dur:8th|Pos:3|Opts:Stem=Down,Beam=End
|Rest|Dur:8th
|Note|Dur:8th|Pos:3
|Note|Dur:8th|Pos:3|Opts:Stem=Down,Beam=First
|Note|Dur:8th|Pos:3|Opts:Stem=Down,Beam
|Note|Dur:8th|Pos:4|Opts:Stem=Down,Beam
|Note|Dur:8th|Pos:3|Opts:Stem=Down,Beam=End
|Bar
|Rest|Dur:8th
|Note|Dur:4th|Pos:1
|Note|Dur:8th|Pos:3
|Note|Dur:8th|Pos:2|Opts:Stem=Down,Beam=First
|Note|Dur:8th|Pos:1|Opts:Stem=Down,Beam
|Note|Dur:8th|Pos:b4|Opts:Stem=Down,Beam
|Note|Dur:8th|Pos:3|Opts:Stem=Down,Beam=End
|Bar
|Note|Dur:8th|Pos:n2|Opts:Crescendo
|Note|Dur:8th|Pos:2|Opts:Crescendo
|Rest|Dur:4th|Opts:Crescendo
|Note|Dur:8th|Pos:2|Opts:Crescendo
|Note|Dur:8th|Pos:2|Opts:Crescendo
|Rest|Dur:4th|Opts:Crescendo
|Bar
|Note|Dur:8th|Pos:n2|Opts:Stem=Down,Crescendo,Beam=First
|Note|Dur:8th|Pos:2|Opts:Stem=Down,Crescendo,Beam=End
|Rest|Dur:4th|Opts:Crescendo
|Note|Dur:8th|Pos:2|Opts:Stem=Down,Crescendo,Beam=First
|Note|Dur:8th|Pos:2|Opts:Stem=Down,Crescendo,Beam=End
|Rest|Dur:4th|Opts:Crescendo
|Bar
|Note|Dur:8th|Pos:b2|Opts:Stem=Down,Crescendo,Beam=First
|Note|Dur:8th|Pos:2|Opts:Stem=Down,Crescendo,Beam=End
|Rest|Dur:4th|Opts:Crescendo
|Note|Dur:8th|Pos:2|Opts:Stem=Down,Crescendo,Beam=First
|Note|Dur:8th|Pos:2|Opts:Stem=Down,Crescendo,Beam=End
|Rest|Dur:4th|Opts:Crescendo
|Bar
|Note|Dur:8th|Pos:2|Opts:Stem=Down,Crescendo,Beam=First
|Note|Dur:8th|Pos:2|Opts:Stem=Down,Crescendo,Beam=End
|Note|Dur:4th|Pos:2|Opts:Crescendo
|Note|Dur:4th|Pos:2|Opts:Crescendo
|Chord|Dur:4th|Pos:3,5|Opts:Crescendo
|Bar
|Chord|Dur:Whole|Pos:3,6|Opts:Crescendo
|Bar
|Rest|Dur:Whole
|Bar
|Dynamic|Style:ff|Opts:Volume=81|Pos:9|Justify:Right
|Chord|Dur:Whole|Pos:-1^,1^
|Bar
|Chord|Dur:Whole|Pos:-1,1
|Bar
|Chord|Dur:Whole|Pos:0^,2^
|Bar
|Chord|Dur:Whole|Pos:0,2
|Bar
|Chord|Dur:Whole|Pos:1,3
|Bar
|Note|Dur:8th|Pos:3
|Note|Dur:4th|Pos:2
|Note|Dur:8th|Pos:-1^
|Note|Dur:8th|Pos:-1|Opts:Stem=Down,Beam=First
|Note|Dur:8th|Pos:3|Opts:Stem=Down,Beam=End
|Note|Dur:4th|Pos:2
|Bar
|Note|Dur:4th|Pos:1
|Note|Dur:Half|Pos:1
|Note|Dur:4th|Pos:1
|Bar
|Note|Dur:Half|Pos:2
|Chord|Dur:Half|Pos:2,3
|Bar
|Chord|Dur:Whole|Pos:3^,6^
|Bar
|Chord|Dur:Whole|Pos:3,6
|Boundary|Style:Collapse
|Bar
|RestMultiBar|NumBars:2|PrintOnce:N|Visibility:Never
|Bar|Style:SectionClose|SysBreak:Y
|Boundary|Style:EndCollapse
!NoteWorthyComposerClip-End

After :
Code: (nwc) [Select · Download]
!NoteWorthyComposerClip(2.5,Single)
|Clef|Type:Treble|OctaveShift:Octave Down|Visibility:Always
|Key|Signature:F#|Tonic:C
|TimeSig|Signature:4/4
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar|Style:Double
|Key|Signature:Bb,Eb,Ab,Db|Tonic:C
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Rest|Dur:Whole
|Bar
|Bar|Style:SectionClose|SysBreak:Y
!NoteWorthyComposerClip-End

- After executing the MMR tool, a boudary change 'Start a collapsible section' is inserted after the time signature. As a result, an empty staff is printed  in the first system.

Code: (nwc) [Select · Download]
!NoteWorthyComposerClip(2.5,Single)
|Clef|Type:Treble|OctaveShift:Octave Down|Visibility:Always
|Key|Signature:F#|Tonic:C
|TimeSig|Signature:4/4
|Boundary|Style:Collapse
|Bar
|RestMultiBar|NumBars:21|PrintOnce:Y
|Bar|Style:Double
|Boundary|Style:EndCollapse
|Key|Signature:Bb,Eb,Ab,Db|Tonic:C
|Boundary|Style:Collapse
|RestMultiBar|NumBars:38|PrintOnce:Y
|Bar
|Boundary|Style:EndCollapse
|Bar|Style:SectionClose|SysBreak:Y
!NoteWorthyComposerClip-End

This boundary change should be placed before the clef, so that nothing is printed
Always look on the bright side of life!

Re: Resting Staff

Reply #6
Thanks for checking it out.  I've added some checking for MMRs in this script so these should pass through now.  Have replaced the code in the first post so after "End duration loop" I am passing through several more objects and allowing notes before and after them to be replaced with same duration rests.

When a staff has an MMR along with consecutive bars of whole rests, it might be helpful to undo the MMRs and then do them over so new rest measures can be included in what had been the previous MMR.  I may need to add more prompts or options to the MMR tool to control visibility when they are layered--changing the MMR in your sample to "Always" or "Top Staff" seemed to fix the problem ... for now.
Since 1998

Re: Resting Staff

Reply #7
Thanks for the quick resolution.
Always look on the bright side of life!