I have a volta repeat with two endings.  There is a clef change during the
first ending; so at the start of the second ending it's necessary to print
another clef to indicate the clef in force at the start of the ending.

Lilypond by default will print the new clef before the repeat barline that
separates the first from the second ending.  I want it, instead, to print
the clef for the start of the second ending after the barline, so it's
more clearly associated with the second ending.

This LSR snippet seems to solve that problem:
  https://lsr.di.unimi.it/LSR/Item?id=1119

It works by putting a grace-note spacer rest at the start of the alternate
ending, putting the clef after the spacer, and then overriding the clef's
extra-spacing-width to make the spacing look right.

However, I also want to set voltaSpannerDuration (or achieve its effect in
some other way, if necessary), and the grace spacer breaks that; the
ending with the grace spacer seems to ignore voltaSpannerDuration.

Code showing the problem:

\new Staff {
  \clef bass
  e1 | e1 |
  \repeat volta 2 {
    f1 | f1 |
    \set Score.voltaSpannerDuration = #(ly:make-moment 1/1)
    \alternative {
      \volta 1 {
        g1 | \clef treble g'1 |
      }
      \volta 2 {
        \grace s4
        \once \override Staff.Clef.extra-spacing-width = #'(-1.5 . 0)
        \clef bass a1 |
        \clef treble a'1 |
      }
    }
  }
  \fine
}

With this code the bracket for the first ending covers only one measure,
but the bracket for the second ending covers the entire second ending, two
measures.  Commenting out the \grace s4 returns both brackets to the
expected length (one measure), but puts the clef before the barline.

So, how can I get a clef after the barline and limit the length of the
volta bracket, on the same alternate ending?

-- 
Matthew Skala
msk...@ansuz.sooke.bc.ca                 People before tribes.
https://ansuz.sooke.bc.ca/

Reply via email to