Adding new Lyrics to music throws off alignment in lilypond
The following code causes an overflow, where the music goes off the side of the page:
It seems that lilypond decides where the line breaks go before considering how lyrics will change spacing. How do I get sensible spacing?
version "2.19.82"
header {
title = "Israel in Egypt"
subtitle = "8. Chorus - He sent a thick darkness over the land"
composer = "Handel"
}
upperPiano = relative c' {
tempo "Largo"
accidentalStyle modern-cautionary
clef treble
key a minor
time 4/4
r4 c c c |
<<
{ c1~ | c~ | c4 bes bes bes~ | bes }
{ r4 aes aes aes | aes1~ | aes2 aes~ | aes4 }
>>
<g ees'> <g ees'> <g ees'> | <g ees'>1~ | <g ees'>4 <g e'> <g e'> <g e'> | <aes d f>1~ |
<aes c f>4~ <g c e> <g c e>2~ | <g c e>1 | <aes c f> |
<a c ges'> | <bes des f> | <aes b d f> | <g c e> | <aes c ees> |
<<
{ bes' | aes }
{ <d, f>2 <bes ees> | <ees c> <d aes> }
>>
<bes ees g> 1 | <bes ees ges>4 <bes ees ges> <bes ees ges> <bes ees ges> |
<bes ees ges> <bes ees ges> <bes ees ges> <bes ees ges> |
<c ees f> <c ees f> <c ees f> <c ees f> | <f, bes ees> <f bes des> <f bes des> <f bes des> |
<f aes d>1~ | <f aes d> | c' | <g bes e> | <f a d>~ |
<f a d>2 <a d a'> | <b d e>1 | <cis e>~ | <cis e> |
<<
{ b'~ | b~ | b}
{ <dis, fis>~ | <dis fis> | <b e> }
>> |
<a c e> | r2 <fis b dis> | <gis b e>1 bar "|."
}
lowerPiano = relative c, {
tempo "Largo"
accidentalStyle modern-cautionary
clef bass
key a minor
time 4/4
r1 | r | r4 <des des' f> <des des' f> <des des' f> | <des des' f>2 <d d' f> | <ees ees'> r |
r4 <bes bes'> <bes bes'> <bes bes'> | <bes bes'>1~ | <bes bes'>4 <b b'> <b b'> <b b'> | <c c'>1~ |
<c c'> | <f f'> | <ees ees'> | <bes bes' f'> | <b b'> | <c c'> | <aes aes'>~ | <aes aes'>2 <g g'> |
<f' f'>1 | <ees ees'> |
<<
{ ees'4 ees ees ees | ees ees ees ees | a,4 a a a | bes bes bes bes }
{ ees,1 | ees | a, | bes }
>>
<b b'>1~ | <b b'> | < c c' e g> | < cis cis' > | <d d'>2 <f, f'>~ | <f f'> <fis fis'> |
<gis gis'>1 | <ais ais' fis'>~ | <ais ais' fis'> | <a a'>~ | <a a'> | <g g'> | <a a'> |
r2 <b b'> | <e, e'>1 bar "|."
}
sopranoMusic = relative c' {
accidentalStyle modern-cautionary
clef treble
r1*8 | r2 r4 e | e2 e4 e | f2 f | r4 ges8. ges16 ges4 ges | f2 r4 f8. f16 | f2. f4 |
e2 r | r ees4. ees8 | f2 g4 r | r aes f4. f8 | bes2 bes4 bes | bes1~ | bes2 ges4 ges |
f1 | r | r4 f8. f16 aes4 f | d2 r | r1*5 | r2 cis'4 ais | fis fis r2 | r1*6
}
sopranoWords = lyricmode {
He sent a thick dark -- ness o -- ver all the land. o -- ver all the land. e -- ven dark -- ness
which might be felt. a thick dark -- ness. He sent o -- ver all the land. a thick dark -- ness
}
altoMusic = relative c' {
accidentalStyle modern-cautionary
clef treble
r1*8 | r2 r4 c | c2 c4 c | c2 c | r4 c8. c16 c4 c | des2 r4 f8. f16 | d2. d4 | c2 r |
r ees4. ees8 | d2 ees4 r | r ees d4. d8 | ees2 r | r ges4 ges | ges2 ees4 ees |
ees2 ees4 ees | ees8( des) des4 r2 | r1*5 | r8 f g a d,4 r | r1*3 | r2 r8 fis dis fis |
b,4 r r2 | r1*4
}
altoWords = lyricmode {
He sent a thick dark -- ness o -- ver all the land. o -- ver all the land. e -- ven dark -- ness
which might be felt. a thick dark -- ness. He sent a thick dark -- ness. o -- ver the land
o'er all the land
}
tenorMusic = relative c' {
accidentalStyle modern-cautionary
clef "treble_8"
r1*8 | r2 r4 g | g2 g4 g | aes2 aes | r4 a8. a16 a4 a | bes2 r4 bes8. bes16 | aes2. aes4 |
g2 r | r c4. c8 | bes2 bes4 r | r c aes4. aes8 | g2 r | r1 | r2 r4 bes | c2 c4 c |
c8( bes) bes4 r2 | r1*2 | r2 r4 e | g bes, r8 bes bes a | f4 r r2 | r2 r4 r8 a16 a |
d4 d r8 d e b | cis4 r r2 | r r4 cis | dis dis r2 | r4 r8 dis dis4. e8 | b4 r r2 | r1*3
}
tenorWords = lyricmode {
He sent a thick dark -- ness o -- ver all the land. o -- ver all the land. e -- ven dark -- ness
which might be felt. He sent a thick dark -- ness. e'en dark -- ness, which might be felt. ev -- en
dark -- ness, which might be felt. a dark -- ness. which might be felt.
}
score {
<<
new ChoirStaff <<
new Staff = "sopranos" with { midiInstrument = #"clarinet" instrumentName = #"Soprano "} <<
new Voice = "sopranos" {
sopranoMusic
}
new Lyrics lyricsto "sopranos" {
sopranoWords
}
>>
new Staff = "altos" with { midiInstrument = #"clarinet" instrumentName = #"Alto" } <<
new Voice = "altos" {
altoMusic
}
new Lyrics lyricsto "altos" {
altoWords
}
>>
new Staff = "tenors" with { midiInstrument = #"clarinet" instrumentName = #"Tenor " } <<
new Voice = "tenors" {
tenorMusic
}
new Lyrics lyricsto "tenors" {
tenorWords
}
>>
new Staff = "basses" with { midiInstrument = #"clarinet" instrumentName = #"Bass " } <<
new Voice = "basses" {
%bassMusic
}
new Lyrics lyricsto "basses" {
%bassWords
}
>>
>>
new PianoStaff <<
set PianoStaff.instrumentName = #"Piano "
new Staff = "upperPiano" upperPiano
new Staff = "lowerPiano" lowerPiano
>>
>>
layout {
context {
}
}
}
2 Comments
Sorted by latest first Latest Oldest Best
For full-bar rests, use cap R not r. As this movement is in 4/4, this means using e.g. R1*3 not r1*3 to mean 3 complete bars' rest. (If a movement is in 3/4, then you would say e.g. R2.*5 for 5 complete bars' rest. You use the correct bar duration even though the "whole-note rest" symbol is used.)
This is the sort of thing that sometimes happens when you get durations wrong and Lilypond fails to find suitable places to take line breaks. Usually such a suitable place occurs at every barline, but this fails to happen if you make a mistake in entering durations.
It also happens if you for example write r1*3 instead of R1*3 to mean "three complete bars' rest". The reason is that with R1*3 Lilypond knows to engrave three successive "full bar rest" symbols, and also knows that it is allowed to break the line in between any two of those three symbols.
However, if r1*3 meant anything it would mean a single rest lasting 3 whole notes. Lilypond tries laying out on the basis that it is not allowed to break the line at any point between the start and the end of this 3-bar period. With the music you had, and with several rests of multiple bars, Lilypond thinks that several bar lines are places where it is not allowed to break the line (even though, if the music is correctly Lilyponded, Lilypond would realise that it is allowed). So Lilypond fails.
The text below is a suggestion I posted on the basis of the effect observed, in the PDF output, by compiling the Lilypond code in the OP. The problem turned out not to be anything related to my suggestions, but I leave them here because these suggestions are relevant to mistakes that Lilypond-coders really do make, which produce the effect the OP observed. So they might help future Lilypond-coders who consult this question. I count myself among Lilypond-coders who make such mistakes!
Check your tenor part's rhythm in bars 30-32. Put bar checks in, then check your .log file. Did the log file report any bar check failures? Did you mistype the duration of any notes?
In addition to Rosie's terrific answer, I'll add one further suggestion:
Once you correct the r rests to R as she suggests, also consider placing the following into your layout block at the bottom of the score:
context {
Lyrics
override LyricSpace.minimum-distance = #1 .0
}
This will even out the spacing of the lyrics for all voices, and some textual breaks that are currently hidden in the score will become more clear.
Terms of Use Privacy policy Contact About Cancellation policy © freshhoot.com2026 All Rights reserved.