2010-02-05

Suppressing key change warnings at the end of a line

Lilypond by default prints key cancellation and then prints the new key signature, even when at the end of a line. No doubt these are helpful to musicians or something, but they look horrible, and can get out of control. It turns out it's relatively complicated to get rid of the cancellation and the new one without removing the normal signature from the following line. However, the following code does what is necessary:


\relative c' {
    \key ces \major
    ges'1 ges1 \bar "|." | \break
    \once \override Score.BreakAlignment #'break-align-orders =
        #(make-vector 3 '(instrument-name
                          left-edge
                          ambitus
                          span-bar
                          breathing-sign
                          clef
                          key-signature
                          time-signature
                          staff-bar
                          custos
                          span-bar))
    \bar "||:"
    \set Staff.printKeyCancellation = ##f
    \set Staff.explicitKeySignatureVisibility = #begin-of-line-visible
    \override Staff.KeySignature #'break-visibility = #begin-of-line-visible
    \key ais \minor
    gis1 eis1 | \break
    gis1 eis1 \bar ":|" |
}

No comments: