How to set a simple song in lilypond with refrain

I am fiddling now a whole day around with trying to set a correct Lilypond notation. While I found with trial and error, that I could display all tones and vocals, I am not able in getting the correct timings (and tones), so I have a few questions.

1. How can I get the right bars and times? It seems that Lilypond sets some weird timings for example with 9/8 timing, and, whatever I do I can't get the bars (or the vocals) to the right places
2. How can I correctly separate the refrain from the main text? The score is without a break and I didn't manage to find the structure for a simple song
3. Does anyone know, what the right English notation I have to write, for example when I try to display a "h"? I´ve tried it with b but it seems, it displays always one octave deeper.
4. The timing is weird, for example on bar 5, there is more than 4/4 tact and on bar #7 i can´t figure out, what is happening at all
5. I try to get a simple framework to convert my songs to Lilypond, therefore I tried to make it as simple as possible, but until now I had no luck.

Here I show what I have found out until now:

\version "2.18.2"[![enter image description here][1]][1]
\include "predefined-guitar-fretboards.ly"

verseI = \lyricmode {
\set stanza = #"1."
Ach was
wird denn mei -- ne Mut -- ter
sa -- gen wenn
ich einst kehr zu    rück?
}
verseII = \lyricmode {
\set stanza = #"2."
Und wenn
ich dann ei -- nen Voll -- bart
ha -- be mein
Sohn was bist jetzt    Du?
}
theChords = \chordmode {
s4  g1  c1  d1  g1
}
staffMelody = \relative c' {
\key d \major
\clef treble
\time 4/4
\override Score.BarNumber.break-visibility = #'#(#t #t #t)
\set Score.currentBarNumber = #1
% Permit first bar number to be printed
\bar ""
\partial 4 a8 d8
fis4 fis8 fis8 fis8 g4 fis8
e4 b2 b'4
f4.  f4 f4 f8
fis2 r4 r4
f8
}
theChordsRefrain = \chordmode {
a d   g1  c1  d1  g1 d g
}
RefrainI = \lyricmode {
\set stanza = #"2."
Ich bin \bar ":|"  Po
lier, fi -- de -- ri, fi -- de
ra, sauf nur noch
Bier -- fi -- de -- ri -- fi -- de
ra -- ich bin Po
lier, sauf nur noch
Bier, ich
bin Po
}
staffRefrain = \relative c' {
\key d \major
\clef treble
\time 4/4
r2  a2 d2 e2
\bar  ".|:-||"
fis4 fis8 fis8 fis4 fis8 fis8
fis4 fis4 g4 fis4
e4  b8 b8   b4  b8 b8
b b4 b4 b4
b2. b8                     % lier sauf
b2. b8                         % nur noch
b8  \bar  ":|."                % Bier Ich
b8  b8 b4                      % bin Po
}
\score {
{
<<
\context ChordNames { \theChords }
\new Staff {
\context Voice = "voiceMelody" { \staffMelody }
}
\new Lyrics = "lyricsI" {
\lyricsto "voiceMelody" \verseI
}
\new Lyrics = "lyricsII" {
\lyricsto "voiceMelody" \verseII
}
>>
<<
\context ChordNames { \theChordsRefrain }
%\new Staff {
\context Voice = "voiceMelody" { \staffRefrain }
%}  % Dont know
\new Lyrics = "RefrainI" {
\lyricsto "voiceMelody" \RefrainI
}
>>
}
}
\layout { }
\midi { }


Addendum: with the help of Alephzero, I managed now to display a better notation:

....
\score {
<<
\context ChordNames { \theChords \theChordsRefrain }
\new Staff {
\context Voice = "voiceMelody" { \staffMelody \staffRefrain }
}
<<
\new Lyrics = "lyricsI" {
\lyricsto "voiceMelody" \lyricmode { \verseI \RefrainI }
}
\new Lyrics = "lyricsI" {
\lyricsto "voiceMelody" \lyricmode { \verseI \RefrainII }
}
\new Lyrics = "lyricsI" {
\lyricsto "voiceMelody" \lyricmode { \verseI \RefrainIII }
}
\new Lyrics = "lyricsI" {
\lyricsto "voiceMelody" \lyricmode { \verseI \RefrainIV }
}
>>
\new Lyrics = "lyricsII" {
\lyricsto "voiceMelody" \lyricmode { \verseII }
}
\new Lyrics = "lyricsIII" {
\lyricsto "voiceMelody" \lyricmode { \verseIII }
}
\new Lyrics = "lyricsIV" {
\lyricsto "voiceMelody" \lyricmode { \verseIV }
}
>>
}
....


Two questions remain: 1) How to place the chords not only at the boundary of the bars 2) How to write the first lyric only once and, because it is the same, not 4 times I attached the new progress (It is not fully correct since it is only an example)

• For your third question, if the b is an octave too low, just insert b' (the ' raises it an octaves, just like a , would lower it an octave). For your fourth question, m. 5 is messed up due to the f8 you have at the end of your staffMelody. Remove this f8 and it will fix m. 5. It will also fix m. 7, which looks strange because that earlier f8 has moved everything else forward one eighth-note. Unfortunately I'm not sure exactly what you mean with questions 1, 2, and 5, so I'm not sure I can help with those right now. – Richard May 16 '16 at 13:35
• @Sam, if i remove f8 from staffMelody, then the whole refrain is gone. With Q1 i mean, that the whole tact in this score is confused, i think, it has something to do with my wrong notation, but i just can't figure it out. Q2 means that i am not able to separate the refrain within the notation so it looks clear and with Q5 i am asking, if there are some simple maybe docs, because the documentation are for me over complex and i need something simpler examples, which i tried with this song, but had no fortune. Thank you – Coliban May 16 '16 at 14:39
• What specifically is the part that you are calling the "refrain" ? That is, how would you like the final score to indicate refrain vs verses? – Carl Witthoft May 16 '16 at 15:50
• @Carl, how we call it, i think, it is called "chorus"? It starts at bar 5 "Ich bin Po -- |: lier, fi de ri, fi de ra, sauf nur noch Bier, fi de ri fi de ra, ich bin Polier, sauf nur noch Bier, ich bin Po :| -- (from beginning). – Coliban May 16 '16 at 17:45
• @Coliban, I see now that removing the f8 does for some reason remove the entire refrain. I was on version 2.19.40 when I first tried it, and that doesn't happen; I'm not sure why it happens in 2.18.2. As for some other weird rhythms, I found the song here, and a number of your rhythms could use some cleaning up. Lastly, do you have to organize your score with a refrain? Why not just use a single score and put in a \bar ".|:" when you need it? – Richard May 16 '16 at 18:44

I think there is a fundamental problem with the way you tried to do this. You defined \context Voice = "voiceMelody" inside the first << ... >> but then tried to reference voiceMelody inside the second << ... >>.

In Lilypond version 18 this seems to crash the program, which is (by definition) a bug, because it should be impossible to cause a crash by supplying the wrong input. But even if it didn't crash, I don't think it wouldn't have done what you wanted.

The easiest way is to create one score that contains both the verse and the chorus, something like this:

% Delete the "f8" at the end of staffMelody
% No other changes from the start until...

RefrainI = \lyricmode {
\set stanza = #"Chorus"
Ich bin  Po
lier, fi -- de -- ri, fi -- de
ra, sauf nur noch
Bier -- fi -- de -- ri -- fi -- de
ra -- ich bin Po
lier, sauf nur noch
Bier, ich
bin Po
}
staffRefrain = \relative c' {
r2  a2 d2 e2
\repeat volta 2 {
fis4 fis8 fis8 fis4 fis8 fis8
fis4 fis4 g4 fis4
e4  b8 b8   b4  b8 b8
b b4 b4 b4
b2. b8                     % lier sauf
b2. b8                         % nur noch
b8                  % Bier Ich
}
b8  b8 b4                      % bin Po
}
\score {
<<
\context ChordNames { \theChords \theChordsRefrain }
\new Staff {
\context Voice = "voiceMelody" { \staffMelody \staffRefrain }
}
\new Lyrics = "lyricsI" {
\lyricsto "voiceMelody" \lyricmode { \verseI \RefrainI }
}
\new Lyrics = "lyricsII" {
\lyricsto "voiceMelody" \lyricmode { \verseII }
}
>>
}


There are several mistakes in the rhythms, but you should be able to fix those. If you write a | character at the end of every bar, Lilypond will give an error message if the length of the notes in the bar don't add up to the correct amount. The reason you got "weird timings" is because Lilypond doesn't care if you write a long note that would continue past the bar line into the next bar - in early music notation (15th and 16th century) music was intentionally written like that, instead of the modern notation using tied notes.

Note, also I changed your attempt at writing a repeat into the standard way to do that, using \repeat volta.

• Ok, Alephzero, with your help, i had some progress. My main problem is still the lilypond documentation, while i have to write down rather simple songs, the docs are like teaching an abecedarian einsteins theory of relativity... I still have some problems: 1) How to get correct horizontal spacing for the chords, now i can only place a chord at the beginning of a bar and 2) is it possible to write the first lyric only once since it is always the same? – Coliban May 17 '16 at 7:39
• @Alepzero, i edited my original posting since i cannot attach a photo in a comment – Coliban May 17 '16 at 7:47
• 1) You can space the chords the same way as spacing notes, with numbers (1, 2, 4, 8) giving the length of each chord. Use s + a number to get an "empty space". 2) Each \new Lyrics ... gives a new line of text. You want something like \new Lyrics = "lyricsI" { \lyricsto "voiceMelody" \lyricmode { \verseI \RefrainI } } \new Lyrics = "lyricsII" { \lyricsto "voiceMelody" \lyricmode { \verseII \RefrainII } } \new Lyrics = "lyricsIII" { \lyricsto "voiceMelody" \lyricmode { \verseIII \RefrainIII } } \new Lyrics = "lyricsIV" { \lyricsto "voiceMelody" \lyricmode { \verseIV \RefrainIV } } } – user19146 May 17 '16 at 16:19
• Thank you, alephzero, i will try it out when i am back home! – Coliban May 19 '16 at 12:30