3

In Lilypond, I'd like to split a melody into variables in order to easily see which syllables belong to which notes. Unfortunately, I am doing it in a way that seems to mess up the vertical alignment of the lyrics.

Lilypond example code:

barI = {
  \relative c {
    c g e e' |
  }
  \addlyrics {
    Ve -- ry first bar.
  }
}

barII = {
  \relative c' {
    c c c c
  }
  \addlyrics {
    and the se -- cond.
  }
}

% ------------------------------------------------
% Staves
% ------------------------------------------------
bass = \new Staff \with {
  instrumentName = #"Bass "
  shortInstrumentName = #"B "
} {
  \clef "bass"
  \key g \major
  \barI \barII
}

% ------------------------------------------------
% Document
% ------------------------------------------------
\header {
  title = "Vertical Lyrics"
  composer = "The famous"
  opus = "DWV 42"
}

\score {
  <<
    \bass
  >>

  \version "2.20.0"
  \midi { }
  \layout { }
}

This is what the output looks like. Lilypond output

Question: What is the best practice to see the notes and lyrics as close as possible in the code, and at the same time get lyrics reasonably aligned vertically in Lilypond's output?

Thanks for any help!

3
  • 1
    This is a consequence of the way you define the lyrics; you have two four-syllable Lyrics objects which (if I understand Lilypond rightly) have nothing to do with each other, so Lilypond doesn't know to align them on the same horizontal base-line. My question to you: why do you use \addlyrics this way? If you had 100 bars in your song and you wanted to check to see if you made a mistake in one syllable, you'd still have to check each of those 100 bars in search of any mistake.
    – Rosie F
    Jul 19, 2020 at 13:18
  • By contrast, if you put all your Bass lyrics into one Lyrics object, and assigned it to the whole Bass part, and you'd made a mistake, then scanning the score, rightwards until you find an error, or leftwards until you see the music align correctly, will enable you to pinpoint the error.
    – Rosie F
    Jul 19, 2020 at 13:20
  • Rosie, thank you for helping me understand how addlyrics works. The way I try to arrange things is less about finding typos in my code. I use Frescobaldi, which does a fantastic job helping me with that. I just found myself re-generating the PDF over and over. So I think I'd save some time by making my code more human-readable, e.g. by seeing the notes and lyrics closely together.
    – Thomas
    Jul 19, 2020 at 15:13

1 Answer 1

3

I'm not sure if there is an easier method, but splitting like this works:

barImelody = \relative c {
  c g e e' |
}
barIlyrics = \lyricmode {
  Ve -- ry first bar.
}

barIImelody = \relative c' {
  c c c c
}
barIIlyrics = \lyricmode {
  and the se -- cond.
}
bass = \new Staff \with {
  instrumentName = #"Bass "
  shortInstrumentName = #"B "
} {
  \clef "bass"
  \key g \major
  {
    \barImelody \barIImelody
  }
  \addlyrics {
    \barIlyrics \barIIlyrics
  }
}

enter image description here

1
  • Glorfindel, this works like a charm. Thanks a lot!
    – Thomas
    Jul 19, 2020 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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