lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strange behavior of repeat unfold inside a repeat volta with alterna


From: Stéphane SOPPERA
Subject: Re: Strange behavior of repeat unfold inside a repeat volta with alternatives.
Date: Wed, 27 Sep 2023 00:04:58 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1

Thanks for the explanation! I was not aware of the previous behavior and that was very confusing.
And I guess I was not expecting alternatives to work with unfold either but that makes sense.

On 2023-09-26 23:53, David Kastrup wrote:
Stéphane SOPPERA <stephane.soppera@wanadoo.fr> writes:

I observed a strange behavior with a /repeat unfold/ inside a /repeat
volta/ with /alternatives/. See the attached /bug_repeat__ok.ly/ for
full source.

Using Lilypond 2.24.1:

    \repeat volta 2 {
      %% Here we repeat three times the same music.
*      \relative { c'4 e g r } |**
**      \relative { c'4 e g r } |**
**      \relative { c'4 e g r } |*
      \alternative {
        \volta 1 \relative { b4 d f g | }
        \volta 2 \relative { b4 d g <c, e g> | }
      }
    }

works as intended, but:

    \repeat volta 2 {
      %% Here we replaced the repetition with an `unfold` repeat.
*      \repeat unfold 3 { \relative { c'4 e g r } | }*
      \alternative {
        \volta 1 \relative { b4 d f g | }
        \volta 2 \relative { b4 d g <c, e g> | }
      }
    }

fails. The measure 5 appears before measure 4, the volta is misplaced
and alternatives are lost (see /bug_repeats__ok.pdf/).

To fix the issue I can put the /repeat unfold/ inside curly brackets:

    \repeat volta 2 {
      %% Here we put the `unfold` repeat inside curly braces.
*      { \repeat unfold 3 { \relative { c'4 e g r } | } }*
      \alternative {
        \volta 1 \relative { b4 d f g | }
        \volta 2 \relative { b4 d g <c, e g> | }
      }
    }

Any idea why Lilypond behaves this way? Am I missing something?
It is a consequence of syntax compatibility to previously when
\alternative could follow a \repeat rather than be inside of its body.
So the last music before an in-\repeat \alternative must not be a
\repeat without \alternative or it will sweep up the \alternative for
itself.  As you noticed, braces are the proper workaround.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]