5

In the following, lines 2-6 have the same notes, yet the bar lines in the middle are not aligned. Is there a way to get them to align? Also, is there a way to extend the bar lines to the lyrics (here generated automatically using NoteNames context)

        \version "2.18.2"

    musicA = {c d e f g a b c c b a g f e d c
                        c d e f c d e f c d e f g a b c
                        c b a g c b a g c b a g f e d c}
    fooBar = { s1 \bar "!" s2 \bar "!" s2 \bar "||" }

    \score {
      \new Staff 
      {

        \compoundMeter #'((4 4) (2 4) (2 4))
        \set Timing.beatStructure = #'(4 2 2 )
        <<
          \new Voice
          {
           \relative c' {\easyHeadsOn \musicA \musicA}


          }
          \context NoteNames  {   
          \musicA }

          \new Voice = "theBarLines" { \repeat unfold 6 {\repeat unfold 2 \fooBar \bar "|." }}
          \new Voice = "breaks" {\repeat unfold 5 {s2*8 \break}}


        >>
    }}
4
  • 3
    Aligning bar lines is not a good idea. It’s too easy to skip a line when they are.
    – Édouard
    Sep 13, 2014 at 21:01
  • 1
    Definitely agreed, unaligned staves is a feature not a bug. Good engraving practice is to force at least a slight misalignment, even when the two lines are identical. Oct 21, 2014 at 1:15
  • 2
    This is not true in all contexts. For example, in jazz lead sheets it's very common practice to deliberately align bars vertically, especially for the majority of tunes which are constructed in multiples of 4 or 8 bars. For example a typical 32-bar AABA structure would have 2 lines of 4 bars for each section, and it's easier to read and learn the tune when it's laid out in this more regular geometric fashion. Mar 16, 2017 at 11:21
  • Bagpipe music is often written with aligned bars with four bars per line.
    – Frotz
    May 20, 2023 at 7:53

1 Answer 1

5

I agree with the comment from Édouard. Of course, one can tell LilyPond to leave all optical corrections that are put in for a more even optical appearance of the music flow (like kernings are in a font). Your question is like asking how to tell your typesetter to have "rivers" in your text line up better.

LilyPond is flexible: you can tell it to stop doing what it is good at.

\version "2.18.2"

musicA = {c d e f g a b c c b a g f e d c
                    c d e f c d e f c d e f g a b c
                    c b a g c b a g c b a g f e d c}
fooBar = { s1 \bar "!" s2 \bar "!" s2 \bar "||" }

\score {
  \new Staff 
  {

    \compoundMeter #'((4 4) (2 4) (2 4))
    \set Timing.beatStructure = #'(4 2 2 )
    <<
      \new Voice
      {
       \relative c' {\easyHeadsOn \musicA \musicA}
      }
      \context NoteNames  { \musicA }
      \new Voice = "theBarLines" { \repeat unfold 6 {\repeat unfold 2 \fooBar \bar "|." }}
      \new Voice = "breaks" {\repeat unfold 5 {s2*8 \break}}
    >>
  }
  \layout {
    \context {
      \Score
      proportionalNotationDuration = #(ly:make-moment 1/4)
      \override NoteSpacing.stem-spacing-correction = #0
      \override NoteSpacing.same-direction-correction = #0
      \override NoteSpacing.knee-spacing-correction = #0
  }}
}
2
  • 1
    Would someone please explain how this works? I'm trying to apply it to something of my own and the bars remain unaligned.
    – Frotz
    Jun 10, 2023 at 7:51
  • same here, this doesn't work for me
    – marktani
    Feb 28 at 18:58

Your Answer

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

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