On 08/07/2024 22:12, Mats Bengtsson wrote:

On 2024-07-08 21:40, Raphael Mankin wrote:
An alternative to the already proposed solutions is to name the Lyrics context that you want to keep, and then reuse it for the refrain:

\version "2.24.3"

melody = { \relative c'
           \repeat volta 3 { a b c d e f g a }
}
verseA = \lyricmode {  This is verse one }
verseB = \lyricmode {  This is verse two }
verseC = \lyricmode {  This is verse three }
chorusWords = \lyricmode {  This is the chorus }

\score {
   \new Staff {
     \melody
     \addlyrics {
       \repeat volta 3 {
         <<
           \new Lyrics = mainlyrics \verseA
           \new Lyrics \verseB
           \new Lyrics \verseC
         >>
         \context Lyrics = mainlyrics \chorusWords
       }
     }
   }
   \layout { }
}

    /Mats


Now that is much neater, but can  it be modified for the case where the refrain precedes the verse, e.g. Satie's "Je Te Veux"?

Maybe these tricks should go into the docs.

The general principle of naming and resuming contexts is described in https://lilypond.org/doc/v2.24/Documentation/notation/creating-and-referencing-contexts and some additional bells and whistles are brought up in https://lilypond.org/doc/v2.24/Documentation/notation/keeping-contexts-alive

Here's a modified version of the above example with the refrain coming before the verses.

\version "2.24.3"

melody = { \relative c'
           \repeat volta 3 { a b c d e f g a }
}
verseA = \lyricmode {  This is verse one }
verseB = \lyricmode {  This is verse two }
verseC = \lyricmode {  This is verse three }
chorusWords = \lyricmode {  This is the chorus }

\score {
   \new Staff {
     \melody
     \addlyrics {
       \new Lyrics = mainlyrics \chorusWords
       \repeat volta 3 {
         <<
           \context Lyrics = mainlyrics \verseA
           \new Lyrics \verseB
           \new Lyrics \verseC
         >>
       }
     }
   }
   \layout { }
}

    /Mats


That is great, thanks. I have not yet got my head around context naming. Clearly I shall have to do some more reading.

Reply via email to