|
From: | Lukas-Fabian Moser |
Subject: | Re: Adding a root note next to the key signature (like a single note Ambitus) |
Date: | Thu, 7 Jul 2022 23:51:47 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 |
Hi Viktor,
Please forgive my ignorance, I have two follow-up questions:
1. How do I change the pitch of the 'root' note? I tried playing with the three numbers from "(+ tonic-position 3) 7) 3)))". But I can't understand their logic.
I'm not quite sure what you mean: The pitch of the 'root' note is taken directly from the \key command.
For example, the following example generates all reasonable roots
for key signatures with two sharps:
{
\key d \major
a'1
\key e \dorian
a'1
\key fis \phrygian
a'1
\key g \lydian
a'1
\key a \mixolydian
a'1
\key b \aeolian
a'1
\key cis \locrian
a'1
}
Does this already solve your question?
But I can also explain the logic behind the three numbers 3 7 3 in the _expression_ you quoted:
To sum up: The 7 should not be changed (that's the amount of
steps in our note name system), and the two 3's should be equal
(and it's no coincidence that 3 = (7-1)/2).
2. How can I remove the parenthesis? I tried but continuously broke the code:-)
The notehead stencil is in the "notehead" variable, and the paranthesized stencil is stored in "notehead-parens". The simplest way to get rid of the parentheses would be to replace "notehead-parens" in the final construction of the stencil by "notehead". But then we can also get rid of "notehead-parens" completely, hence we get:
notehead_key_signature = #
(lambda (grob)
(let*
((key-sig (ly:key-signature-interface::print grob))
(notehead
(grob-interpret-markup grob
(markup #:tiny #:musicglyph
"noteheads.s2")))
(tonic (assq-ref (ly:grob-property grob 'details) 'tonic))
(tonic-position (+ (ly:pitch-steps tonic)
(ly:grob-property grob 'c0-position)))
(adjusted-tonic-position
(- (modulo (+ tonic-position 3) 7) 3)))
(ly:stencil-combine-at-edge
key-sig X RIGHT
(ly:stencil-translate-axis notehead
(/ adjusted-tonic-position 2) Y)
0.5)))
HTH
Lukas
[Prev in Thread] | Current Thread | [Next in Thread] |