Browse Source

Remove subtext root notes from lilypond key signatures. They cannot be transposed

master
Nils 2 years ago
parent
commit
7c76afa600
  1. 18
      engine/items.py

18
engine/items.py

@ -2286,26 +2286,10 @@ class KeySignature(Item):
schemepairs = " ".join(schemepairs.split()) # split and join again to reduce all whitespaces to single ones.
assert schemepairs
#For Transposition in lilypond we need to explicitly export all scheme pairs, not only the one that differ from major.
#subtextRoot = "\\once \\override Staff.KeySignature #'stencil = #(lambda (grob) (ly:stencil-combine-at-edge (ly:key-signature-interface::print grob) Y DOWN (grob-interpret-markup grob (markup #:small \"" + pitchmath.pitch2ly[self.root].strip(",").title() + "\")) 3)) " #3 is the space between keysig and text
#lyKeysignature = subtextRoot + "\\set Staff.keyAlterations = #`( {} )".format(schemepairs)
lyKeysignature = f"\n\\key {pitchmath.pitch2ly[self.root].strip(',')} #`( {schemepairs} )\n"
lyKeysignature = f"\n\\key {pitchmath.pitch2ly[self.root].strip(',')} #`( {schemepairs} )\n"
return lyKeysignature
#!!!!THIS IS DEAD CODE!!
#Alternative
schemepairs = " ".join(build(num, alt) for num, alt in enumerate(self.deviationFromMajorScale))
schemepairs = " ".join(schemepairs.split()) # split and join again to reduce all whitespaces to single ones.
subtextRoot = "\\once \\override Staff.KeySignature #'stencil = #(lambda (grob) (ly:stencil-combine-at-edge (ly:key-signature-interface::print grob) Y DOWN (grob-interpret-markup grob (markup #:small \"" + pitchmath.pitch2ly[self.root].strip(",").title() + "\")) 3)) " #3 is the space between keysig and text
if schemepairs:
lyKeysignature = subtextRoot + f"\\key {pitchmath.pitch2ly[self.root].strip(',')} #`( {schemepairs} )"
else: #no explicit accidental
lyKeysignature = subtextRoot + "\\set Staff.keyAlterations = #`(( 0 . ,NATURAL))" #TODO: subtextRoot position is broken
return lyKeysignature
class Clef(Item):
"""A clef has no direct musical logical meaning. But it gives some hints:
Voice range. A typical musical voice in a polyphonic setup has between one and two octaves range

Loading…
Cancel
Save