2

In my piece, I want a single score in order to be able to output a single midi file.

The entire piece is polyphonic with two voices.

The structure should look like this:

chorus in two voices (with lyrics)
verses in two voices (with numbered lyrics)

I put together the structure below, but I don't want a piano staff or choir staff. I just want one staff, but to have the chorus separated from the verses. The chorus has one set of lyrics, the verses have another.

Now, I don't want to add the chorus lyrics to one of the verse lyrics and then use spacers as placeholders - because I am using a macro to number the verses lyrics.

\version "2.19.80"
\language "english"

%create new lyrics and add numbered lines
%creates:    \new Lyrics \with { instrumentName = "8." shortInstrumentName = "8." }
lyricsWithVerseNumber =
#(define-music-function (parser location number music)(number? ly:music?) #{
    \new Lyrics \with { instrumentName = #(string-append (number->string number) ".") shortInstrumentName = #(string-append (number->string number) ".")  }
    $music
#})    

  signature = {
      \key c \minor
  }
  chorusUpper = \relative c'' {
\signature
  g g g g
  }
  chorusLower = \relative c' {
\signature
  e e e e
  }
  versesUpper = \relative c'' {
\signature
  a a a a
  }
  versesLower = \relative c' {
\signature
  f f f f
  }

  chorusLyrics = \new Lyrics \lyricsto "chorus" {
    A song has words
  }
  wordsOne = \new Lyrics \lyricsWithVerseNumber 1 \lyricsto "verses" {
    More words for this
  }
  wordsTwo = \new Lyrics \lyricsWithVerseNumber 2 \lyricsto "verses" {
    Some words go here
  }
  wordsThree = \new Lyrics \lyricsWithVerseNumber 3 \lyricsto "verses" {
    Sing a bit more
  }

  \score {
      <<
          \time 4/4  
          \new Voice = "chorus" {\voiceOne \chorusUpper  }
          \new Voice { \voiceTwo \chorusLower }
          \chorusLyrics

          \new Staff {
              \new Voice = "verses" {\voiceOne \versesUpper  }
              \new Voice { \voiceTwo \versesLower }
          }
          \wordsOne
          \wordsTwo
          \wordsThree          

      >>
    \layout {
    }    

      %\midi { }
  }

How can I get the chorus with it's verse to show above the verses with their lyrics in a single score? With this code here it tries to create a choir staff - three staves joined together.

  • 1
    Maybe you could, please, stop posting non-working examples which use undefined escaped strings such as \signature. Either take them off, or define all macros in the same file. – Paco Vila Mar 7 '18 at 12:42
  • I was figuring that folks more experienced than I would be able to look at my file construction and know how to arrange things without having to compile it. As for the \signature I added it. – bgmCoder Mar 7 '18 at 16:11
  • 1
    @bgmCoder I think that the Minimum Working Example rule of TeX.SE works the same for LilyPond questions. The whole thing is that you want some help, so you should make it as easy a possible for others to help you. That's why your code should be minimal to show the problem, but complete. – yo' Mar 7 '18 at 16:14
  • Sorry for the trouble. Okay, I'll post working examples from now on. – bgmCoder Mar 7 '18 at 17:38
  • I've updated the code for cut and paste. – bgmCoder Mar 7 '18 at 17:59
2

I think this structure will work for your needs:

\version "2.19.81"
\language "english"

highVoiceChorus = \relative c' {
  e4. e4. | 
  e4 f8 g4. |
}

lowVoiceChorus = \relative c' {
  c4. c4. |
  c4 d8 e4. |
}

lyricsChorus = \lyricmode {
  Row, row, row your boat
}

highVoiceVerses = \relative c'' {
  c4 c8 c4 c8 |
  c4. c4. |
}

lowVoiceVerses = \relative c'' {
  g4 g8 a4 a8 |
  g4. g4. |
}

lyricsVerseOne = \lyricmode {
  \set stanza = "1. "
  Hap -- py hap -- py joy joy!
}

lyricsVerseTwo = \lyricmode { 
  \set stanza = "2. "
  Oh how hap -- py we are!
}

chorus = <<
  \new Voice = "highChorus" {
    \voiceOne
    \highVoiceChorus
  }
  \new Voice = "lowChorus" {
    \voiceTwo
    \lowVoiceChorus
  }
  \new Lyrics {
    \lyricsto "lowChorus" {
      \lyricsChorus
    }
  }
>>

verses = <<
  \new Voice = "highVerse" {
    \voiceOne
    \highVoiceVerses
  }
  \new Voice = "lowVerse" {
    \voiceTwo
    \lowVoiceVerses
  }
  \new Lyrics {
    \lyricsto "lowVerse" {
      \lyricsVerseOne
    }
  }
  \new Lyrics {
    \lyricsto "lowVerse" {
      \lyricsVerseTwo
    }
  }
>>

song = {
  \time 6/8
  \chorus
  \break
  \verses
}

\paper {
  ragged-right = ##t
}

\score {
  \new Staff \song
  \layout {
    indent = 0
  }
}
  • Wow, that is a lot different that the path I was taking. But it does, indeed work! I was thinking to keep the << >> parts for the chorus and the verses directly in the \score context. – bgmCoder Mar 7 '18 at 21:58
  • To clarify a bit, << >> is used to put simultaneous music. Instead, verses go sequentially after chorus. Here, @ksnortum used \break to make verses to appear visually below. – Paco Vila Mar 8 '18 at 11:16
  • @bgmCoder, I am a strong believer in keeping the \score block small. The more the code is broken into logical blocks, the better. It helps to organize your code and makes maintenance easier. – ksnortum Mar 9 '18 at 13:13
  • Well, I am a programmer, and like to organize into OOP blocks, myself, so I'm not really disappointed. Thanks for your help. I've gotten my hymn fixed and used the same procedure to fix a similar one. – bgmCoder Mar 9 '18 at 17:24

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.