Hi Lukas,
On 25/07/2020 20:16, Lukas-Fabian Moser wrote:
I stumbled upon a score in G minor where a E natural would be marked
as a E note preceded by a sharp symbol. What would be a “clean” way to
achieve that?
I have thought of redefining the natural symbol by the sharp one, but:
1. I don't know how to do this.
2. This would not work in an other key signature with sharps where, I
assume, the natural would be marked with flat symbols.
Perhaps:
\version "2.20.0"
forceSharp =
\tweak Accidental.stencil #ly:text-interface::print
\tweak Accidental.text ##{ \markup { \sharp } #}
\etc
forceFlat =
\tweak Accidental.stencil #ly:text-interface::print
\tweak Accidental.text ##{ \markup { \flat } #}
\etc
\relative {
\key f \major
f' g a \forceSharp b
}
\relative {
\key g \major
a' g \forceFlat f e
}
I like this solution! And it made me discover a few new things, which is
always great :-)
This probably has to be customized if you use mensural glyphs.
By playing with the documentation, I finally found out how to access the
mensural glyphs, and a mensural version of your suggestion could be:
forceSharp =
\tweak Accidental.stencil #ly:text-interface::print
\tweak Accidental.text ##{ \markup { \musicglyph "accidentals.mensural1"
} #}
\etc
forceFlat =
\tweak Accidental.stencil #ly:text-interface::print
\tweak Accidental.text ##{ \markup { \musicglyph
"accidentals.mensural-1" } #}
\etc
---
Now I also looked into the sources for the definition of the "alteration
mensural glyph name alist" and found this:
(define-public alteration-mensural-glyph-name-alist
'((-1/2 . "accidentals.mensuralM1")
(0 . "accidentals.vaticana0")
(1/2 . "accidentals.mensural1")))
and this allowed me to define two variations, one that replaces the
natural by the flat, and one that replaces it by the sharp. They can
then be used accordingly:
\version "2.20.0"
#(define-public alteration-mensural-natural-as-sharp-glyph-name-alist
'((-1/2 . "accidentals.mensuralM1")
(0. "accidentals.mensural1")
(1/2 . "accidentals.mensural1")))
#(define-public alteration-mensural-natural-as-flat-glyph-name-alist
'((-1/2 . "accidentals.mensuralM1")
(0. "accidentals.mensuralM1")
(1/2 . "accidentals.mensural1")))
\relative {
\key f \major
\override Staff.Accidental.glyph-name-alist =
#alteration-mensural-natural-as-sharp-glyph-name-alist
f' g a b b
}
\relative {
\key g \major
\override Staff.Accidental.glyph-name-alist =
#alteration-mensural-natural-as-flat-glyph-name-alist
a' g f e f
}
---
I haven't found a clever way to do that while taking into account the
key signature, but this sounds good enough for me. That gives us both a
way to do it systematically, and a way to do it locally. I like having
the choice.
Thanks a lot for your help!
Best,
— Niols