Skip to main content
Topic: BarCounter.nw (Read 17173 times) previous topic - next topic

BarCounter.nw

This object can be used to create a custom bar counter. It can be useful when embedding multiple songs into a single file.

Code: (nwc) [Select · Download]
!NoteWorthyComposerClip(2.75,Single)
|User|BarCounter.nw|Pos:8|Class:StaffSig
!NoteWorthyComposerClip-End

Usage:

  • turn off the built-in bar counter from File, Page Setup
  • add this object at the start of your file
  • add new instances of this object whenever you want to reset the bar count

Re: BarCounter.nw

Reply #1
The miracle power of 2.75....
Thank you.

Re: BarCounter.nw

Reply #2
Updated with a new Show on all bars option.


Re: BarCounter.nw

Reply #3
In parts for brass band, I have seen the custom that every other measure is numbered - e.g. here: <Image Link>

I changed the BarCounter a little so that it can do this (I cannot add a file here - so I'll just desribe what I changed):

  • obj_spec: AllBars --> {id='EveryNthBar',label='Every n-th bar (0 for none)',type='int',default=1,min=0,max=100},
  • everyBar --> local everyNthBar = t.EveryNthBar
  • if hideFirst and everyNthBar <= 0 then return end
  • if everyNthBar > 0 then
  • and finally: if (barCount - startAt) % everyNthBar == 0 then c.text(barCount) end

Here is the result for an alto sax part of my march ...

... but I do not know how one would upgrade gracefully files with BarCounters such that the "AllBars" is replaced with "EveryNthBar=1" silently.

H.M.

P.S. Maybe there should also be an option to select the font class - the "StaffBold" is much "heavier" than the small numbers in Adrenalina ...

Re: BarCounter.nw

Reply #4
I replaced the original bar count with this version.  Please forgive my disappointment with it.
The score runs on several lines on the printed page. The bar count only displays on the first screen width and only prints on the first line - so useless for me.
Could also do with the option to only display the bar number every 5th bar - e.g. 5,10,15 etc.
How do i get back my original bar count?

 

Re: BarCounter.nw

Reply #5
I replaced the original bar count with this version.  Please forgive my disappointment with it.
How do i get back my original bar count?

If you are going to work with a custom plugin, you should rename it to something other than a the standard name used in this forum, For BarCounter, I would recommend using something like BarCounter.local.

You can always acquire the latest version of any installed plugin using Manage Objects. The synch tool can be used to replace any local changes you have made to one of the standard plugins.

Re: BarCounter.nw

Reply #6
... but I do not know how one would upgrade gracefully files with BarCounters such that the "AllBars" is replaced with "EveryNthBar=1" silently.
This can be done via the "audit" event. You can see examples of this type of thing in Arpeggio.ms and Glissando.ms.
P.S. Maybe there should also be an option to select the font class - the "StaffBold" is much "heavier" than the small numbers in Adrenalina ...
That would not be too difficult to add. It might also be handy to implement the box/circle options that native measure numbers have, to give more consistent appearance for people who migrate from native to custom numbering.

Re: BarCounter.nw

Reply #7
I am only now getting into objects.  Great work!  I appreciate that people who do not have to take the time to write functional code that gives us a process we did not have before.  Obviously you have tested it to make sure it does not crash the software or our files.  That it does not do everything we could imagine it doing is to be expected since (I assume) this is not your bread and butter gig.

I have always run into the problem of the pickup bar.  I do not like counting this, because it throws me off in the standard 8/16 bar format.  I am using BarCount for the first time to designate the pickup bar as "0".  Now new stanzas and choruses begin on 1 plus a multiple of 8, making it easier to find my edit points.

Thank you!
[_] Believe God  (Prov. 3:5-8) <-----<>----------> [_] Believe in Yourself (Jer. 17:9)
                                          >------>  Choose  ONE <----<

Re: BarCounter.nw

Reply #8
OK, so when I say "pickup bar, I mean the partial measure at the start of the song that contains the opening notes, not the local public gathering place where men and women ... .
[_] Believe God  (Prov. 3:5-8) <-----<>----------> [_] Believe in Yourself (Jer. 17:9)
                                          >------>  Choose  ONE <----<

Re: BarCounter.nw

Reply #9
I have always run into the problem of the pickup bar.  I do not like counting this, because it throws me off in the standard 8/16 bar format.  I am using BarCount for the first time to designate the pickup bar as "0". 

You can just Exclude From Bar Count on a pickup bar:

Code: (nwc) [Select · Download]
!NoteWorthyComposerClip(2.75,Single)
|Bar|XBarCnt:Y
!NoteWorthyComposerClip-End

Re: BarCounter.nw

Reply #10
Hello all -

Does the "Exclude from Bar Count" feature work with this - and does it if the bar to be excluded is not a simple bar, but a Master Repeat Open or Close?

Thanks for any advice!

// Edit: Added some more courtesy after having fired off the posting too quickly before hurrying to a rehearsal ...

Re: BarCounter.nw

Reply #11
Answer to myself: "Exclude Bar Count" does currently not work with BarCounter. But I made it work by changing line 142 of the script from
Code: [Select · Download]
local isBar = (objt == 'Bar')
to
Code: [Select · Download]
local isBar = (objt == 'Bar' and drawidx1:objProp('XBarCnt') ~= 'Y')
Maybe this could be integrated into the official version of the plugin (the flag isBar could be renamed to isCountingBar to make its intent clearer).

Edit: (At least) also line 111 needs to change - otherwise one gets funny jumping measure numbers:
Code: [Select · Download]
elseif objt == 'Bar' and obj:objProp('XBarCnt') ~= 'Y' then

H.M.

Re: BarCounter.nw

Reply #12
Another addition I made to my local copy: An "optional suffix" that is added to the bar numbers.
An example can be seen in the score at http://www.hmmueller.de/MyMusic/20170602b-ch.DuranteMagnificatSSAB_5.pdf, where I had to number the last 9 measures with 1a...9a because of a split of parts 5 and 6 that is different in another score used by the soloists.
(The code changes are trivial - adding the parameter; and concatenating it with barcounter at two .text() calls).

H.M.

P.S. The score also uses @Lloyd 's ConnectBarLines - adding them went ahead quite quickly with the help of UltraEdit to set the "Staff Location" in each staff ... many thanks again for this!)

Re: BarCounter.nw

Reply #13

It would be nice if the custom bar counter object gave a choice for fonts, circles and squares as discussed by hmmeuler and Mike below two years ago. 


I really like this object, but minor tweaks would be nice. 

Also the "help" could be enhanced - for instance, you can choose "all eligible bars" - what does that mean?  On my current score, the bar count prints only at bar 5 of the first page, the first bar of the first system on pages 2 to 5, but then it normalizes on pages 6 to 50.  showing on each bar.  I thought it had something to do with notes on the first system being in leger-line land, but high notes are on that staff throughout the score.

Re: BarCounter.nw

Reply #14
Also the "help" could be enhanced - for instance, you can choose "all eligible bars" - what does that mean?  On my current score, the bar count prints only at bar 5 of the first page, the first bar of the first system on pages 2 to 5, but then it normalizes on pages 6 to 50.  showing on each bar.  I thought it had something to do with notes on the first system being in leger-line land, but high notes are on that staff throughout the score.
I assume you inserted the object at the very beginning of your score, and not in a later measure. Its effects will only show in measures that follow it. It will probably also not show if the staff it is in is collapsed/hidden.  If you would be willing to share your score, perhaps we can troubleshoot.

Mike

Re: BarCounter.nw

Reply #15
Thanks, Mike.  I'm not worried about it, since I've printed the score already and will be giving it to my conductor on Monday, but if it reveals a glitch in the user object, it might be nice to fix it for subsequent users.

The attached image shows the numbers are on all top system bars until the file is printed.

While the work is POP, copyright still subsists since the arranger died less than 50 years ago, so I will send you the NWC file by personal message.