Keeping a Lyrics context alive: Difference between revisions
Appearance
m Replace version="2.24.0" with version="2.24" now that the LilyWiki extension supports auto-selecting the latest release in a stable series |
mNo edit summary |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
If you temporarily have additional lyrics to a voice you can keep the lyrics context alive with the following construct. Unless you do this, a further temporary lyrics context would create a separate line (if it happens on the same system of music). | If you temporarily have additional lyrics to a voice you can keep the lyrics context alive with the following construct. Unless you do this, a further temporary lyrics context would create a separate line (if it happens on the same system of music). | ||
The solution is to create one or more named | The solution is to create one or more named <code>Lyrics</code> context(s) with | ||
\new Lyrics = "lyr1" | |||
\new Lyrics = "lyr2" | |||
... | |||
'''before''' they are filled with the lyrics text. | '''before''' they are filled with the lyrics text. | ||
Note that the definition of the contexts '''must''' use <code>\new ...</code> while later references ''must'' use <code>\context ...</code>. | |||
<lilypond version="2.24"> | <lilypond version="2.24"> | ||
\score { | \score { | ||
\new Staff << | \new Staff << | ||
| Line 21: | Line 19: | ||
b \repeat volta 2 {b} | b \repeat volta 2 {b} | ||
} } | } } | ||
\context Lyrics ="line1" \with{ associatedVoice = "melody" } \lyricmode | \context Lyrics = "line1" \with{ | ||
associatedVoice = "melody" | |||
one | } \lyricmode { | ||
one | |||
<< % this is the 1st temporary lyric part | << % this is the 1st temporary lyric part | ||
\context Lyrics = "line1" { one } | \context Lyrics = "line1" { one } | ||
\context Lyrics = "line2" { two } | \context Lyrics = "line2" { two } | ||
% the context "line2" dies here | % the context "line2" dies here | ||
>> | >> | ||
one | one | ||
<< % this is the 2nd temporary lyric part | << % this is the 2nd temporary lyric part | ||
\context Lyrics = "line1" { one } | \context Lyrics = "line1" { one } | ||
| Line 39: | Line 38: | ||
</lilypond> | </lilypond> | ||
[[Category:Vocal music]] | [[Category:Vocal music]] | ||
[[Category:Workaround]] | [[Category:Workaround]] | ||
[[Category:Snippet]] | |||
Latest revision as of 10:05, 3 December 2025
If you temporarily have additional lyrics to a voice you can keep the lyrics context alive with the following construct. Unless you do this, a further temporary lyrics context would create a separate line (if it happens on the same system of music).
The solution is to create one or more named Lyrics context(s) with
\new Lyrics = "lyr1" \new Lyrics = "lyr2" ...
before they are filled with the lyrics text.
Note that the definition of the contexts must use \new ... while later references must use \context ....
\version "2.24"
\score {
\new Staff <<
\new Voice = "melody" {
\relative c'' {
a1 \repeat volta 2 {a}
b \repeat volta 2 {b}
} }
\context Lyrics = "line1" \with{
associatedVoice = "melody"
} \lyricmode {
one
<< % this is the 1st temporary lyric part
\context Lyrics = "line1" { one }
\context Lyrics = "line2" { two }
% the context "line2" dies here
>>
one
<< % this is the 2nd temporary lyric part
\context Lyrics = "line1" { one }
\context Lyrics = "line2" { two }
>>
}
>>
}