volta repeats with alternatives

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

volta repeats with alternatives

Felix Krause
Hi all,

I have two problems with endings of volta repeats:

1) I have a volta repeat with an alternative ending, like this:

\override Score.BarNumber #'break-visibility = #'#(#t #t #t)
\repeat volta 2 { r4 f r f }
\alternative { { r f r f } {  r f r a, } }
d a d a

The two endings should have the same bar (=measure) number. But  
lilypond increments the bar number of the second ending by 1. This is  
pretty annoying, as I need to manually set the bar number, like this:

\override Score.BarNumber #'break-visibility = #'#(#t #t #t)
\repeat volta 2 { r4 f r f }
\alternative { { r f r f } {
\set Score.currentBarNumber = #2
r f r a, } }
d a d a

Is there a setting or something to do this automatically? Why isn't it  
done by default anyway? (btw: the override command is just used to  
demonstrate the problem, I only need the measure numbers at the  
beginning of each line.)


2) I want to place a mark over the bar right after the second ending:

\repeat volta 2 { r4 f r f }
\alternative { { r f r f } {  r f r a, } }
\bar "||" \mark "A"
d a d a

The "A" is printed above the bar of the second ending - it would be  
prettier to have it right above the bar. I found this in the language  
reference to shorten the bars:

\repeat volta 2 { r4 f r f }
\alternative { { r f r f } {
\set Score.voltaSpannerDuration = #(ly:make-moment 3 4)
          r f r a, } }
\bar "||" \mark "A"
d a d a

Unfortunately, this closes the second bar with a vertical line for  
some reason. How do I make it stay open? (or how do I print the "A" to  
the same height as the bar without shortening it?)


Cheers,
Felix


_______________________________________________
lilypond-user mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: volta repeats with alternatives

Paul Scott-3
Felix Krause wrote:

> Hi all,
>
> I have two problems with endings of volta repeats:
>
> 1) I have a volta repeat with an alternative ending, like this:
>
> \override Score.BarNumber #'break-visibility = #'#(#t #t #t)
> \repeat volta 2 { r4 f r f }
> \alternative { { r f r f } {  r f r a, } }
> d a d a
>
> The two endings should have the same bar (=measure) number. But
> lilypond increments the bar number of the second ending by 1. This is
> pretty annoying, as I need to manually set the bar number, like this:
>
> \override Score.BarNumber #'break-visibility = #'#(#t #t #t)
> \repeat volta 2 { r4 f r f }
> \alternative { { r f r f } {
> \set Score.currentBarNumber = #2
> r f r a, } }
> d a d a
>
> Is there a setting or something to do this automatically? Why isn't it
> done by default anyway? (btw: the override command is just used to
> demonstrate the problem, I only need the measure numbers at the
> beginning of each line.)

This has been discussed here before.  This is the way LilyPond works.  
Lily's way is consistent with many printed scores even though your way
is sometimes done.

Paul Scott





_______________________________________________
lilypond-user mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: volta repeats with alternatives

Anthony W. Youngman
In message <[hidden email]>, Paul Scott
<[hidden email]> writes
>> Is there a setting or something to do this automatically? Why isn't
>>it done by default anyway? (btw: the override command is just used to
>>demonstrate the problem, I only need the measure numbers at the
>>beginning of each line.)
>
>This has been discussed here before.  This is the way LilyPond works.
>Lily's way is consistent with many printed scores even though your way
>is sometimes done.

There's a third way too ... I sometimes come across pieces where - let's
say - an eight bar repeated phrase is counted as sixteen bars. Usually
because some other part has the repeat written out in full.

But yes - the lilypond way is the way I normally see music - I almost
never see it where two bars have the same number. Why would you do that?
The main reason for bar numbers is, surely, for the conductor to be able
to accurately identify a bar during a rehearsal. How is an ambiguous bar
number going to help? What use are bar numbers if they are ambiguous?

Cheers,
Wol
--
Anthony W. Youngman - [hidden email]



_______________________________________________
lilypond-user mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: volta repeats with alternatives

Mats Bengtsson-4
In reply to this post by Felix Krause


Felix Krause wrote:

> Hi all,
>
> I have two problems with endings of volta repeats:
>
> 1) I have a volta repeat with an alternative ending, like this:
>
> \override Score.BarNumber #'break-visibility = #'#(#t #t #t)
> \repeat volta 2 { r4 f r f }
> \alternative { { r f r f } {  r f r a, } }
> d a d a
>
> The two endings should have the same bar (=measure) number. But
> lilypond increments the bar number of the second ending by 1. This is
> pretty annoying, as I need to manually set the bar number, like this:
>
> \override Score.BarNumber #'break-visibility = #'#(#t #t #t)
> \repeat volta 2 { r4 f r f }
> \alternative { { r f r f } {
> \set Score.currentBarNumber = #2
> r f r a, } }
> d a d a
>
> Is there a setting or something to do this automatically? Why isn't it
> done by default anyway? (btw: the override command is just used to
> demonstrate the problem, I only need the measure numbers at the
> beginning of each line.)
One alternative is to (mis)use the \partial command in the following way:
\relative c' {
\override Score.BarNumber #'break-visibility = #'#(#t #t #t)
\repeat volta 2 { r4 f r f }
\alternative { { r f r f } {
  \partial 1
  r f r a, } }
d a d a
}
As you can see from the typeset output, the difference is that it will
not write out the bar numbers in the second repeat, but the subsequent
bar numbers will be counted as if the first and second endings had the
same bar number. At second thought, this method is not preferable if
your second ending includes several measures. Even though, you can get
the subsequent bar numbers the way you want them by inserting \partial
1*3 (or whatever number of measures), the full second ending will be
counted as a single measure when it comes to the typesetting of
automatic accidentals.

A perhaps better solution is to use some Scheme code, to add an offset
to the current bar number:
\version "2.12.0"
% Inspired by http://lsr.dsi.unimi.it/LSR/Item?id=333
adjustBarNumber = #(define-music-function (parser location offset) (number?)
  (make-music 'ApplyContext
              'origin location
              'procedure (lambda (x)
               (begin
                 (ly:context-set-property!
                  (ly:context-property-where-defined x 'internalBarNumber)
                  'internalBarNumber
                  (+ offset (ly:context-property x 'internalBarNumber)))
                 (ly:context-set-property!
                  (ly:context-property-where-defined x 'currentBarNumber)
                  'currentBarNumber
                  (+ offset (ly:context-property x 'currentBarNumber)))))))

\relative c' {
\override Score.BarNumber #'break-visibility = #'#(#t #t #t)
\repeat volta 2 { r4 f r f }
\alternative { { r2 f r f } {
  \adjustBarNumber #-2
  r f r a, } }
d a d a
}

You don't have to understand how it works to use it, just copy the
definition of adjustBarNumber and use it with \adjustBarNumber #-4 if
you want to decrease the bar number by 4 or \adjustBarNumber #5 if you
want to increase it by 5, for example.

    /Mats

>
>
> 2) I want to place a mark over the bar right after the second ending:
>
> \repeat volta 2 { r4 f r f }
> \alternative { { r f r f } {  r f r a, } }
> \bar "||" \mark "A"
> d a d a
>
> The "A" is printed above the bar of the second ending - it would be
> prettier to have it right above the bar. I found this in the language
> reference to shorten the bars:
>
> \repeat volta 2 { r4 f r f }
> \alternative { { r f r f } {
> \set Score.voltaSpannerDuration = #(ly:make-moment 3 4)
>       r f r a, } }
> \bar "||" \mark "A"
> d a d a
>
> Unfortunately, this closes the second bar with a vertical line for
> some reason. How do I make it stay open? (or how do I print the "A" to
> the same height as the bar without shortening it?)
>
>
> Cheers,
> Felix
>
>
> _______________________________________________
> lilypond-user mailing list
> [hidden email]
> http://lists.gnu.org/mailman/listinfo/lilypond-user

--
=============================================
        Mats Bengtsson
        Signal Processing
        School of Electrical Engineering
        Royal Institute of Technology (KTH)
        SE-100 44  STOCKHOLM
        Sweden
        Phone: (+46) 8 790 8463
        Fax:   (+46) 8 790 7260
        Email: [hidden email]
        WWW: http://www.s3.kth.se/~mabe
=============================================



_______________________________________________
lilypond-user mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user