Take the 2-minute tour ×
Musical Practice & Performance Stack Exchange is a question and answer site for musicians, students, and enthusiasts. It's 100% free, no registration required.

I am typesetting a score that contains alternate endings on a volta repeat, as well as chords (using LilyPond 2.17.97). By default, the following MWE:

    song = {
        \repeat volta 2 {
            a1
        }
        \alternative {
            { a }
            { b }
        }

        \bar "|."
    }

    harmonies = \chordmode {
        a1 b c
    }

    \score {
        <<
            \new ChordNames {
                \set chordChanges = ##t
                \set noChordSymbol = ##f
                \harmonies
            }
            \new Staff = "melody" \relative c'' {
                \clef treble
                \key a \major
                \time 4/4

                \song
            }
        >>
        \layout {}
    }

renders:

Default LilyPond output

This looks bad to me; the alternate ending lines being so far above the staff is confusing and makes your eye glance over them. Using the following tweaks I can place the chords over the ending marks:

    song = {
        \repeat volta 2 {
            a1 a1 a1 \break a1
        }
        \alternative {
            { a }
            { b }
        }

        \bar "|."
    }

    harmonies = \chordmode {
        a1 b c d e f
    }

    \score {
        <<
            \new ChordNames {
                \set chordChanges = ##t
                \set noChordSymbol = ##f
                \harmonies
            }
            \new Staff = "melody" \with {
                % Ensure that the chords are printed over the volta
                \consists "Volta_engraver"
            }{
                \relative c'' {
                    \clef treble
                    \key a \major
                    \time 4/4

                    \song
                }
            }
        >>
        \layout {
            \context {
                \Score
                \remove "Volta_engraver"
            }
        }
    }

which produces (extra notes / break added to illustrate the problem):

MWE tweaked

The alternate endings look alright now, but the chords before the alternate endings on the second line are way above the staff and have a lot of whitespace around them.

What is the usual way to solve this problem in published scores and how can I implement it in LilyPond? Would one simply move the chords that aren't above alternative endings closer to the staff (that also seems like it would look bad to me since the chords would no longer all be inline vertically)?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Try

song = {
  \repeat volta 2 {
    a1
  }
  \alternative {
    { a }
    { b }
  }

  \bar "|."
}

harmonies = \chordmode {
  a1 b c
}

\score {
  <<
    \new Staff = "melody" \with { \accepts ChordNames } <<
      \new ChordNames {
        \set chordChanges = ##t
        \set noChordSymbol = ##f
        \override ChordName.outside-staff-priority = #1100
        \override ChordName.direction = #UP
        \harmonies
      }
      \relative c'' {
        \clef treble
        \key a \major
        \time 4/4

        \song
      }
    >>
  >>
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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