Positionng rests in the middle of a two-voice line

In choir scores, you often have the score for two voices (e.g., soprano and alto) in one line:

      \new Staff  = "Frauen"<<
         \new Voice = "Sopran" { \voiceOne \global  \soprano }
         \new Voice = "Alt" { \voiceTwo \global  \alto }
      >>

When they both have a pause at the same time with the same length, lilypond will still print two rests in different positions. If you (like me) think this looks weird, here is how you can change it:

soprano = \relative c' { a2 \oneVoice r4 \voiceOne } a4 }
alto = \relative c' { a2 s4 } a4 }

In one voice, change to only one voice with \oneVoice for the rest and then back to the usual voice, here /voiceOne. If you do the same in the other voice, you will get warnings about clashing notes, so instead of using a rest, use an invisible rest (spacer) with s.

An alternative is the following command which causes all rests to appear in the middle of the line. It should be used inside the \layout block:

   \override Voice.Rest #'staff-position = #0

Solo plus choir in LilyPond

For a song, I want to have first a solo part (or a unisono part), then afterwards for the refrain or for the coda a full choir part. This is how it works in Lilypond (it may not be the best solution, but one that works).

Define the solo parts:

solo = \relative a' {
   c,4 d e f
   c d e f
   \bar "||"
   \break
}
sololyrics =  \lyricmode {
   la la la la
}

Then define the choir parts just like you normally would (see this post).

And put everything together. We have one voice/staff for the solo and another for the choir. In the choir parts, add a rest for the duration of the solo part to the beginning, in the example we have two measures, so we’ll use R1*2, but if you have more, then just adapt the number:

\score{
<<

   \new Staff <<
      \new Voice = "SoloVoice" << \global \solo >>
      \new Lyrics \lyricsto "SoloVoice" \sololyrics 
   >>

   \new ChoirStaff <<      
      \new Staff  = "Frauen"<<
         \new Voice = "Sopran" { R1*2  \voiceOne  \sopran }
         \new Voice = "Alt" { R1*2  \voiceTwo  \alt }
         \new Lyrics \lyricsto "Sopran" \refrainlyrics 
      >>      
      \new Staff = "Maenner"<<
         \clef bass
         \new Voice = "Tenor" { R1*2  \voiceOne  \tenor }
         \new Voice = "Bass" {  R1*2 \voiceTwo  \bass }
         \new Lyrics \lyricsto "Tenor" \refrainlyrics 
      >>      
   >>
>>

And finally, we need to suppress the empty staves in the beginning, which is done in the layout block:

\layout {
   \context { 
      \Staff
      \RemoveEmptyStaves
      \override VerticalAxisGroup #'remove-first = ##t
   }
}

Adjusting spacing in lilypond

Because I always forget how to do it, this is my default (for explanations see the Lilypond manual):

\paper {
   top-markup-spacing #'basic-distance = #5 % title to page top
   markup-system-spacing #'basic-distance = #15 % first system to title
   system-system-spacing #'basic-distance = #20 % between systems
}

A template for typesetting choir scores in Lilypond

LilyPond is LaTeX for music. You write down the music in a text file, typeset it with LilyPond and the output is a pdf containing sheet music in a beautiful layout. They have very good tutorials at the web page, so head over there to learn more. I just wanted to put my template for choir scores here for future reference.

\version "2.16.0" 


\header {
   title = "Titel"
   composer = "Composer"
}

global = { 
   \key c \major 
   \time 4/4 
}


sopran = \relative c' {
   c4 d e f
   g1   
   \bar "|." 
} 

alt = \relative c' {
   c4 c c c
   c1
} 

tenor = \relative c {
   c4 d e f
   g1
}

bass = \relative c {
   c4 c c c
   c1
}


strophe = \lyricmode {
   Sing -- ing as a test!
} 


% == Part for pdf ==
\score {
<<
   \new ChoirStaff <<
      
      \new Staff  = "Frauen"<<
         \new Voice = "Sopran" { \voiceOne \global  \sopran }
         \new Voice = "Alt" { \voiceTwo \global  \alt }
         \new Lyrics \lyricsto "Sopran" \strophe 
      >>
      
      \new Staff = "Maenner"<<
         \clef bass
         \new Voice = "Tenor" {\voiceOne \global \tenor }
         \new Voice = "Bass" { \voiceTwo \global  \bass }
         \new Lyrics \lyricsto "Tenor" \strophe 
      >>

   >>
>>

\layout {
   indent = 0.0\cm
   \context {\Score 
   }
}

}


% == Part for midi ==
\score { \unfoldRepeats
<<
   \new ChoirStaff <<      
      \new Staff <<
         \new Voice = "Sopran" { \global  \sopran }
      >>
      \new Staff <<
         \new Voice = "Alt" { \global  \alt }
      >>
      \new Staff <<
         \new Voice = "Tenor" { \global  \tenor }
      >>
      \new Staff <<
         \new Voice = "Bass" { \global  \bass }
      >>
   >>
>>
\midi {
   \tempo 4=112
   \set Staff.midiInstrument = "voice oohs" 
}

}

The parts sopran, alt, tenor, bass contain the music for the respective voices. strophe contains the text.

The first score element is for creating the pdf – that’s what the layout part is for. We will have two parallel staves (lines) of music, one for the women voices with a treble clef, one for the men voices with a bass clef. The text will be typeset below each staff, distributed to the notes according to the voices of soprano and tenor.

The second score element is for creating the midi – hence the midi part. Here we separate the four voices into four staves, so that we can turn them on and off separately in a midi player. The unfoldRepeats command is necessary if your piece has voltas (repetitions). You need the command to get the midid to include the repetitions at the places you specify them. Otherwise it will just skip ahead to the next part which is usually not what you want.

That’s it, have fun!