Hi, I am trying to overwrite the key signature for my custom music notation
so that instead of displaying the sharp and flat icons, it shows a given
number and the alteration. So, for example, E Major would show 4# instead
of ####.

I have been able to get the desired output by hardcodeing it using the
markup function. However, I am not finding a way to conditionally render
the number and alteration depending on the key. Could somebody help me?

Here is my tiny hardcoded example, with a screenshot:

[image: image.png]

\version "2.23.6"

\layout {
\context {
\Staff
\override KeySignature.stencil = #ly:text-interface::print
\override KeySignature.text = \markup {
\combine
\halign #-1 \lower #1 \musicglyph "four"
\halign #-5 \musicglyph "accidentals.sharp"
}
}
}

\relative {
\clef bass
\key e \major
cis dis e
}

Reply via email to