Skip to main content
Topic: BarCounter.hmm 0.5 (Read 9627 times) previous topic - next topic

BarCounter.hmm 0.5

This is my replacement for the original BarCounter.nw object, with a few extended features I found necessary on large scores. I'm very grateful to NWC for the initial code for this plugin, which I only extended at a few places:

  • Hide the number at left margin: This is useful if a bar counter is used on a lower staff in a large (e.g. orchestral) score so that there are no numbers colliding with the vertical line connecting all staves at the left margin.
  • Every n-th bar: Scores for marching bands often have numbers at every other bar (I found this also helpful in our choral scores); some scores are numbered at every fifth bar.
  • Optional suffix: If a score's numbers must correspond with some existing voice or other scores, but e.g. a repeated section is expanded (e.g. to improve page handling; or for differing articulations), it is helpful to distinguish the now equally numbered bars somehow, e.g. with a suffixed "a".
  • Excluded numbers: Sometimes numbers collide with other signs (crescendos in choral scores are notorious for that, as they are usually shown above the staves); easily dropping one or a few numbers can be helpful.
  • Font: Font selector; default is "StaffBold".
  • Scale: Label sizing in percent; default 100%.
  • Check consecutive numbering: Check whether the numbers from a previous BarCounter object are continued at this object; this is helpful to check that bar numbering is correct on all staves; default is true.
  • Last, but not least, this plugin honors the "Exclude From Bar Count" checkbox on bars.

The first attached file shows a few demo cases and explains them. However, the real use of these feature can only be seen in larger scores. If someone is interested in such examples, please let me know. The second file shows the effect of a numbering error.

H.M.

Re: BarCounter.hmm 0.1

Reply #1
Nice work! I have one small suggestion that would make the object even more versatile: rather than have a "Use Lyrics Font" checkbox, why not just add a "Font" dropdown, which defaults to StaffBold but can be set to any of the available fonts? And if you want to really go whole hog, you could add a "Text Scale (%)" parameter.

Keep up the great work!

Mike

Re: BarCounter.hmm 0.2

Reply #2
Thanks Mike - I have rewritten it per your suggestion; and also (hopefully) fixed a numbering bug when a bar has both "Force System Break" and "Exclude From Bar Count" checked.

H.M.

Re: BarCounter.hmm 0.3

Reply #3
The plugin needed a tiny correction because of a bug; and the example score needed an update because it had some old fields in it. These changes bumped the version to 0.3.

H.M.

Re: BarCounter.hmm 0.3

Reply #4
I have encountered a small bug.  I insert a "Boundary Change" to drop the start of the staff on the page.  This is followed a couple measures in with a "Boundary Change Reset" to return to the staff default.  The BarCounter is inserted as you would think, at the beginning.  Occasionally, a measure number is skipped over, eg, the measure count goes form 7 to 9.  It doesn't seem to be predictable.  When I scroll slowly to find where the problem lies, everything looks normal until one final scroll arrow click causes all the measure numbers to vanish momentarily and then reset to the +1 values.

As a workaround, I found that if I immediately follow the "Boundary Change reset" with an additional instance of BarCounter, everything works perfectly.  [Version 0.3}

Re: BarCounter.hmm 0.3

Reply #5
"Mhm" - yes, I think I have seen something like that, but only once or twice. Do you have a score that has this problem so that I can look into it? Thanks for the workaround, in any case!

H.M:

 

Re: BarCounter.hmm 0.3

Reply #6
Hello there, HM.  I've stripped down the score to just one failing instrument (the tuba, of course).
It's pretty straightforward. Hopefully, it will reliably fail for you, too.

Thanks,
Ed

Re: BarCounter.hmm 0.3

Reply #7
I found an instance where the "workaround" also fails.  BarCounter absolutely does not like to precede the MMR plugin in a measure.  To correct the problem, I added an instance of BarCounter after each measure containing MMR (which worked).  Experimenting, I moved the "workaround" back one measure (to avoid the MMR).  Problem also went away.  I adjusted the previous-posted failing score for illustration.

Re: BarCounter.hmm 0.4

Reply #8
For a choral piece with string quartet, I usually need seven different scores: conductor's score, choral score, rehearsal score (with piano instead of strings), and four voices for the strings. Each one needs bar numbers, and I use my BarCounter.hmm object extensively to number every other measure. However, I make errors - mainly by having additional bars from some edit experiment; or forgetting to mark some in-measure bar line with "Exclude From Bar Count".

After three years of distributing not only one score with one-off errors, I finally added a simple flag that checks whether the numbers are consecutive at a next BarCounter object.

Typically, one would add a BarCounter object in the final measure of each staff that shows numbering in some score, and set its starting number to the expected last bar number. If the bar count is not correct there, an error message is shown above it - see the example score attached to the initial posting. I finally hope to have flawless numbers in the years to come.

H.M.

Re: BarCounter.hmm 0.4

Reply #9
I found an instance where the "workaround" also fails.  BarCounter absolutely does not like to precede the MMR plugin in a measure.  To correct the problem, I added an instance of BarCounter after each measure containing MMR (which worked).  Experimenting, I moved the "workaround" back one measure (to avoid the MMR).  Problem also went away.  I adjusted the previous-posted failing score for illustration.

Thanks for this tip! Bar counting (like some other objects) does not work nicely with MMR, unfortunately. But I have no good idea how to repair this.

H.M.

Re: BarCounter.hmm 0.4

Reply #10
I'm not sure if this the same bug reported above. I've noticed with a couple of scores, the measure numbers in the edit screen (with viewer mode on or off) change as I scroll the screen (from Image1 to Image2). They seem to always be correct in the Print Preview, so it's not all that serious. It does seem to be related to MMRs. If I scroll further right, the problem goes away.

Re: BarCounter.hmm 0.4

Reply #11
Thanks again - I have just confirmed that it is a bug in my code - but I do not yet know what the problem is. I'll try to find it out!

H.M.

Re: BarCounter.hmm 0.5

Reply #12
I have uploaded version 0.5 in the initial posting, which should be without the MMR bugs. If anyone still finds problems with it, please let me know!

H.M.

Re: BarCounter.hmm 0.5

Reply #13
After 3 years I rediscovered this object, and it is really nice. One thing I noticed, comparing my nwc version to the original (which had similar bar numbers): For numbers starting at the beginning of a line, the original placed them immediately after the key signature (and time signature, if present). This object placed them under (and conflicting with) the clef. Would that be an option you might consider adding?

Re: BarCounter.hmm 0.5

Reply #14
Hu - thanks for suggestion - I'd have to look into it. I use the object extensively (also the checking option, after having delivered voice prints with "slightly differing" measure numbers - all hell broke loose  >:( ), so I should have enough test cases. But may take a few weeks, as ... too much to do.

H.M.