Hi Viktor,
Am 05.07.22 um 20:17 schrieb Viktor Mastoridis:
For educational purposes, I would like to see whether it's possible to
add a small note head after the key signature?
Like a single Ambitus note, really.
Why would I do it?
For example, I would like to add a (small) D note to a G-Major key
signature, suggesting that, despite the F# key indicating G-major or
E-minor scale, this piece is in D-Myxolydian mode.
Maybe something like this?
\version "2.23.10"
key_internal = #key
key =
#(define-music-function (tonic pitch-alist)
((ly:pitch?) (number-pair-list?))
#{
\override Staff.KeySignature.stencil =
#(grob-transformer
'stencil
(lambda (key-sig stil)
(let*
((notehead
(grob-interpret-markup key-sig
(markup #:tiny #:musicglyph
"noteheads.s2")))
(notehead-parens (parenthesize-stencil notehead 0.1 0.3 0 0.1))
(tonic-position (+ (ly:pitch-steps tonic)
(ly:grob-property key-sig 'c0-position)))
(adjusted-tonic-position
(- (modulo (+ tonic-position 3) 7) 3)))
(ly:stencil-combine-at-edge
stil X RIGHT
(ly:stencil-translate-axis notehead-parens
(/ adjusted-tonic-position 2) Y)
0.5))))
\key_internal $tonic $pitch-alist
#})
{
\key d \mixolydian
a'1
\key a \mixolydian
1
\key g \mixolydian
1
\key g \dorian
1
\key c \minor
1
\clef bass
d1
\break
1
}
Lukas