Without investigating how the bar number engraver (I'm guessing, or
whatever engraves them), I am unsure how to correct what actually gets
*engraved* (which is obviously important), but here's a partial solution.
\adjustBarNum
applies the repeats and
does the calculations
,
and seems to reset
each
next *currentBarNumber* to what it should be. Maybe someone with more
knowledge of
how
bar number
s are
engrave
d can
have a look and see what is wrong/missing
.
=== begin snippet
adjustBarNum =
#(define-music-function (num mus)
(number? ly:music?)
(define startBar 0)
#{
#(make-apply-context
(lambda (context)
(let ((currentBar (ly:context-property context
'currentBarNumber)))
(set! startBar currentBar))))
\repeat volta #num { #mus }
#(make-apply-context
(lambda (context)
(let* ((endBar (ly:context-property context
'currentBarNumber))
(repLength (+ (if (equal? startBar 1) 0 1)
(- endBar startBar)))
(lenScaled (* repLength num))
(nextBar (+ startBar lenScaled)))
(ly:context-set-property! context 'currentBarNumber
nextBar))))
#})
\score {
\new Staff {
\tempo 4 = 108
\clef "bass"
\time 4/4
\key f \minor
\override Score.BarNumber.break-visibility = #'#(#t #t #t)
\barNumberCheck #1
\adjustBarNum 4 { \rhPatternA }
% adds 4 bars ... (1 + 4 = 5)
\barNumberCheck #5
\adjustBarNum 16 { \rhPatternA }
% adds 16 bars ... (5 + 16 = 21)
\barNumberCheck #21
\adjustBarNum 4 { \rhPatternB }
% adds 4 bars ... (21 + 4 = 25)
\barNumberCheck #25
\adjustBarNum 2 {\rhPatternA }
}
}
=== end snippet
On Thu, Feb 16, 2017 at 1:54 PM, ptoye <[email protected]> wrote:
> Thanks for your comments Jeffery.
>
> Here's some of the music I'm trying to set. I'm not worried about the full
> score aspect, just the piano part. As you can see, it doesn't indicate how
> many repetitions there should be, and the bar numbers don't increment
> correctly.
>
> This is just a one-bar repetition, so my third comment isn't relevant.
>
> I've been using currentBarNumber so your typo wasn't a problem.
>
> \version "2.19.52"
>
> \language "english"
>
> rhPatternA =
> {
> \relative
> {
> f,16 f r af af r ef ef r c ef c ef bf' af ef |
> }
> }
>
> rhPatternB =
> {
> \relative {
> bf,16-> bf af bf-> r4 r2 |
> }
> }
> lhPatternA =
> { \relative
> {
> f,,16 f r af af r ef ef r c ef c ef bf' af ef |
> }
>
> }
> lhPatternB =
> {
> \relative {
> bf,,16-> bf af bf-> r4 r2 |
> }
>
> }
> \score {
>
> \new Staff {
> \tempo 4 = 108
> \clef "bass"
> \time 4/4
> \key f \minor
> \repeat volta 4 {\rhPatternA } |
> \repeat volta 16 { \rhPatternA }
> \repeat volta 4 {\rhPatternB }
> \repeat volta 2 {\rhPatternA }
> }
> }
>
>
>
>
> --
> View this message in context: http://lilypond.1069038.n5.
> nabble.com/Bar-counts-and-repeats-in-repetitive-music-tp199814p200204.html
> Sent from the User mailing list archive at Nabble.com.
>
> _______________________________________________
> lilypond-user mailing list
> [email protected]
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>
--
Jeffery Shivers
jefferyshivers.com
soundcloud.com/jefferyshivers
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user