Skip to main content
Topic: Bar Numbers (Read 23621 times) previous topic - next topic

Bar Numbers

I have started to put several movements into one nwc file to simplify printing and save a bit of paper now that I have a printer that will print on both sides of the paper.

This means that bar numbers do not agree with printouts of individual movements and causes some debate amongst the group....

I have had a preliminary look to see how I could achieve equanimity and the barnumberdemo looks like a possible route to follow. However what I would really like to do is to reset the internal bar counter at say a double bar.

The bar number appears in a clip as a context object which seems to take a single value from the start of the clip. Is there any way that the bar count for each clip item can be retrieved and possibly re-set?

I suspect this may not be possible and would appreciate being put out of my misery at an early stage if I am barking up the wrong tree.

I continue to spread the word re NWC but it is surprising how people can be put off by the low cost prefering to pay seven or eight times as much for very (finale) little extra.
I'll understand all this $thing-> $somethingelse one day...

Re: Bar Numbers

Reply #1
what I would really like to do is to reset the internal bar counter at say a double bar.
In a copy of nwsw_BarNumberDemo.php, somewhere after:
Quote from: nwsw_BarNumberDemo.php
require_once("lib/nwc2clips.inc");
add this:
Quote from: Rick G.
class MyPlayContext extends NWC2PlayContext {
   function UpdateContext($o) {
      if ($o->GetObjType() == 'Bar' and $o->GetTaggedOpt('Style') == 'Double') {
         $this->NextBarNum = 1;
      }   
      return parent::UpdateContext($o);
   }
}
then change:
Quote from: nwsw_BarNumberDemo.php
$PlayContext = new NWC2PlayContext();
to:
Quote from: Rick G.
$PlayContext = new MyPlayContext();
I'm far from expert at OOP, but it seems to do what you want.
Registered user since 1996

Re: Bar Numbers

Reply #2
Many thanks Rick. I will see what I can do with the tip. As an infrequent dabbler into the wonderful world of php I usually flail around for a bit before getting things to "work".

I would love to see a detailed breakdown of nwc's variables and procedures as it is rather like shaking hands with a black box but I realise that is probably asking too much. If I had written the code I would be too busy improving it to write up a programmers manual and give away my secrets. Not a complaint just an idle wish.

NWC is great open source would make it a world beater.
I'll understand all this $thing-> $somethingelse one day...

Re: Bar Numbers

Reply #3
Well that worked a treat and I can add a test to only write every n bars. Thanks Rick. I will still look to see if it is possible to tweak the nwc bar numbering but fully expect to run into a cul-de-sac.
I'll understand all this $thing-> $somethingelse one day...

Re: Bar Numbers

Reply #4
Well. You went from "I will see what I can do with the tip" to "that worked a treat" in 16 minutes. But still you add: I "fully expect to run into a cul-de-sac." Perhaps you should rename yourself: Peter (aka Eeyore:)
Reminds me of the 13th Beautitude: "Blessed are ye who expect nothing: for ye are seldom disappointed."
Registered user since 1996

Re: Bar Numbers

Reply #5
Quote
"Blessed are ye who expect nothing: for ye are seldom disappointed."
...unless things turn out well.


Re: Bar Numbers

Reply #7
Quote
In the long run the pessimist may be proved right, but the optimist has a better time on the trip.
- Daniel L. Reardon





(BTW, whose message is Haymo referring to?)




Re: Bar Numbers

Reply #9
This is my measure number insertion tool.  Start with your correctly numbered text measure number and it will be incremented and inserted in every measure that follows unless the bar line is hidden or excluded from bar count. nummeas.htm.
Since 1998

Re: Bar Numbers

Reply #10
I have modified the nummeas link in the above post.  The model measure number can be anywhere inside the first measure and it is no longer necessary for the measure number to be the first thing in objects cut to the clipboard.  The entire staff may be used by this page.

If the model measure number comes after the first two beats in the first measure, incremented measure numbers will be placed in following measures after at least two beats have gone by.  If a measure starts with a dotted half or whole note, a measure number would be inserted after that note.

Edited change: It now supports multimeasure rests.
Since 1998

Re: Bar Numbers

Reply #11
Announcing my first ever:
Code: (nwc) [Select · Download]
!NoteWorthyComposerClip(2.5,Single)
|Tempo|Tempo:200
|Instrument|Patch:61
|Chord|Dur:8th|Pos:-6,-4,-2,1
|Bar
|Chord|Dur:Whole|Pos:-6,-4,-2,1
!NoteWorthyComposerClip-End

True User Tool

Download the attachment and rename it to remove the .txt from the end.  To install while in NWC do Alt/F8 and click on New...  The command consists of the word wscript, a space, and location/name of the file.  Clip Text is selected and none of the options are checked.

It works the same way the webpage does.  If the first thing selected in the model text measure number, generated measure numbers will either be the first or last thing in a measure, depending on whether or not the second object is a bar line.  If placed in the middle of a measure, created measure numbers will appear after the same number of beats (if possible) or later.  Select whole staff (or don't select anything) for this option.  The model measure number MUST be in the first (selected) measure.

Many thanks to Rick G. for some excellent examples.
Since 1998