TransWikia.com

Lilypond: how to align lyrics vertically if the melody is split into variables?

Music: Practice & Theory Asked on October 25, 2021

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!

One Answer

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

Answered by Glorfindel on October 25, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP