|
From: | Lukas-Fabian Moser |
Subject: | Re: Adding a root note next to the key signature (like a single note Ambitus) |
Date: | Tue, 5 Jul 2022 23:39:37 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 |
Hi Viktor,
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
[Prev in Thread] | Current Thread | [Next in Thread] |