I am currently dealing with a piece of vocal music that has sections which repeat musically but have different lyrics variants for the first and second time of the repeated segments.
Consider the following code, where I have prepared four examples (A–D), each with folded and unfolded repeats:
\version "2.24.1"
% MELODY
% Only the structure is relevant here.
voiceOne = \relative {
\partial 4 a'4
\repeat volta 2 { a a a a | }
\repeat volta 2 { b b b b | }
}
% LYRICS VERSION A
% Basic lyrics example with unchanging lyrics.
% Works in both the folded and the unfolded version.
lyricsA = \lyricmode {
a
\repeat volta 2 { a a a a | }
\repeat volta 2 { b b b b | }
}
% Setting up lyrics snippets for volta variants.
aCommonPart = \lyricmode { a }
aVoltaOne = \lyricmode { a a a a | }
aVoltaTwo = \lyricmode { A A A A | }
bVoltaOne = \lyricmode { b b b b | }
bVoltaTwo = \lyricmode { B B B B | }
% LYRICS VERSION B
% This just uses the same structure for lyrics as a voice would.
% When folded, it fails.
% I would want this to produce output like version D when folded.
lyricsB = \lyricmode {
\aCommonPart
\repeat volta 2 {
\alternative {
\volta 1 \aVoltaOne
\volta 2 \aVoltaTwo
}
}
\repeat volta 2 {
\alternative {
\volta 1 \bVoltaOne
\volta 2 \bVoltaTwo
}
}
}
% LYRICS VERSION C
% More logical structure compared to version D, but causes bad alignment.
% When unfolded, it obviously fails.
lyricsC = \new Lyrics = "C" {
\aCommonPart
<<
{ \aVoltaOne }
\new Lyrics { \aVoltaTwo }
>>
<<
{ \bVoltaOne }
\new Lyrics { \bVoltaTwo }
>>
}
% LYRICS VERSION D
% This produces the desired output when folded.
% When unfolded, it obviously fails.
lyricsD = \new Lyrics = "D" {
\aCommonPart
<<
{ \aVoltaOne \bVoltaOne }
\new Lyrics { \aVoltaTwo \bVoltaTwo }
>>
}
\markup { "A" }
\new Staff \voiceOne
\addlyrics \lyricsA
\new Staff \unfoldRepeats \voiceOne
\addlyrics \lyricsA
\markup { "B" }
\new Staff \voiceOne
\addlyrics \lyricsB
\new Staff \unfoldRepeats \voiceOne
\addlyrics \lyricsB
\markup { "C" }
\new Staff \voiceOne
\addlyrics \lyricsC
\new Staff \unfoldRepeats \voiceOne
\addlyrics \lyricsC
\markup { "D" }
\new Staff \voiceOne
\addlyrics \lyricsD
\new Staff \unfoldRepeats \voiceOne
\addlyrics \lyricsD
This produces the following output:
Is there a better way to achieve version D (folded)? This is the main thing I need and I wanted to know if what I used here could be improved, before using it at a larger scale.
Is there a way to achieve the result of version B (unfolded) and version D (folded) from the same markup? If not, is there a chance that this will work somehow in the future? Version B would be so intuitive...
\voiceOne
is a bad name for a variable because it hides the LilyPond keyword. MaybevoiceA
?