Lilypond: manually print a key signature (or cancellation)

528 views Asked by At

My piece involves a D.S. al coda repeat across a key signature change, like:

\mark \markup { \musicglyph #"scripts.segno" }

\key a \minor
a b c' d'
% more music in a minor

\key a \major
a b cis' d'
% more music in a major

\once \override Score.RehearsalMark #'break-visibility = #end-of-line-visible
\once \override Score.RehearsalMark #'self-alignment-X = #RIGHT
\mark "D.S. al coda"
\bar "||"

% coda in a major follows

To help the player make the transition back from a major to a minor at the dal segno I'd like to print a key cancellation just before the double bar. The bars of the coda that follows, should remain in a major.

How would I accomplish that in Lilypond 2.14 or higher?

1

There are 1 answers

0
Tobias Kretschmar On

Append to your code

\key a \minor  % change key back from a-major to a-minor
s1             % enforce output of key cancellation with a hidden rest
\bar ""        % suppress trailing bar