2

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:

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...

1
  • 2
    \voiceOne is a bad name for a variable because it hides the LilyPond keyword. Maybe voiceA?
    – ksnortum
    Commented Mar 27, 2023 at 18:08

1 Answer 1

1

You can achieve the structure you want (lyric verses stacked when folded, and yet under the correct measures when unfolded) by using the command: \unfolded. This command is used to specify how a repeated section changes when unfolded; it is particularly useful for repeats that aren't exact.

The relevent documentation can be found on this page: https://lilypond.org/doc/v2.24/Documentation/notation/long-repeats#other-variation-in-repeated-sections


\version "2.24.1"

%% MUSIC
music = {
    \new Staff {
        \new Voice = "melody" {
            \partial 4
                a'4 |
            \repeat volta 2 {
                a'4 4 4 4 |
            }
            \repeat volta 2 {
                b'4 4 4 4 |
            }
        }
    }
}

%% Lyric snippets
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 E
lyricsE = {
    \new Lyrics \lyricsto "melody" {
        \aCommonPart
        \repeat volta 2 {
            \volta #'()
                <<
                    \aVoltaOne
                    \new Lyrics {
                        \aVoltaTwo
                    }
                >>
            \unfolded {
                \volta 1 {
                    \aVoltaOne
                }
                \volta 2 {
                    \aVoltaTwo
                }
            }
        }
        \repeat volta 2 {
            \volta #'()
                <<
                    \bVoltaOne
                    \new Lyrics {
                        \override LyricText.Y-offset = #2.8
                        \bVoltaTwo
                    }
                >>
            \unfolded {
                \volta 1 {
                    \bVoltaOne
                }
                \volta 2 {
                    \bVoltaTwo
                }
            }
        }
    }
}

%% METHOD E
methodE = {
    <<
        \music
        \lyricsE
    >>
}

%% FOLDED SCORE
\score {
    \methodE
}

%% UNFOLDED SCORE
\score {
    \unfoldRepeats
    \methodE
}

This should give a result like your method D when folded, and like your method B when unfolded.


(As seen in your method C) the nested \new Lyrics commands introduce an extra vertical offset to separate the verses. This offset for the second volta A's is desired, but a double offset for the second volta B's is not. I have used an override with a magic number to overcome this; I'm sure there is a cleaner way to remove the double offset, but I couldn't find it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.