2

In my piece I want to have two voices on one staff, with lyrics, like in the docs.

But lilypond tries to create two staves like on a ChoirStaff.

\version "2.19.80"
\language "english"

signature = {
    \key c \minor
}

soprano = {
    \signature
    \voiceOne
    g f e f
}

alto = {
    \voiceTwo
  e b e c
}

verseOne = \lyricmode {
This is a song
}

verseTwo = \lyricmode {
A- no- ther verse
}
verseThree = \lyricmode {
One last verse here
}

\score {
<<
\new Staff 
  \new voice = "soprano" \soprano \relative c'
  \new voice = "alto" \alto \relative c'

  \new Lyrics \lyricsto "soprano" \verseOne
  \new Lyrics \lyricsto "soprano" \verseTwo
  \new Lyrics \lyricsto "soprano" \verseThree
>>
}

There are three verses to the song, and I want to have the soprano stems go up and the alto stems go down.

What do I do?

  • Your code is not compilable, please make an autonomous, minimum working example which shows your problem. – Paco Vila Mar 7 '18 at 11:59
  • Okay, I added the signature for you and a few notes. I figured this was easy enough for someone with experience to understand without needing to compile it. I'm used to Stack Overflow where we deal with snippets of code all the time. – bgmCoder Mar 7 '18 at 16:27
2

You need to add grouping to your staff using << ... >>. (The basic idea is that adding << ... >> when structuring the score is rarely harmful.

Also, note that \relative c' should be before the notes to be "relativised" and not after; this is general to any LilyPond functions.

Working code:

\version "2.19.80"
\language "english"

signature = {
    \key c \minor
}

soprano = {
    \signature
    \voiceOne
    g f e f
}

alto = {
    \signature
    \voiceTwo
    e b e c
}


\score { <<
    \new Staff <<
        \new Voice = "soprano"
            \relative e' \soprano
        \new Voice = "alto"
            \relative g' \alto
    >>
    \new Lyrics \lyricsto "soprano" { a b c d }
    \new Lyrics \lyricsto "soprano" { aa bb cc dd }
    \new Lyrics \lyricsto "soprano" { aaa bbb ccc ddd }
>> }
  • Ah - I had tried using the brackets to no avail. The solution was to put \soprano and \alto after \relative. I never would have thought of that and was just trying to do what I saw in examples. The music part works perfectly, now. However, I forgot to show my lyrics setup in my code; I'll update that - maybe you could show me that too, since it says cannot find voice. Sorry about that! Thanks for your time. – bgmCoder Mar 7 '18 at 16:57
  • @bgmCoder One possible problem: you can't have Lyrics above the associated Voice this way, then you need to use the \context construction. – yo' Mar 7 '18 at 16:59
  • Okay, I'm looking through docs to try and figure this out; not sure where to look or what to look for, but I'm looking. – bgmCoder Mar 7 '18 at 18:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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