Ok, I figured out a way to differentiate between major and minor keys. I followed the example of this snippet which shows how to access the tonic note of the current key: http://lsr.dsi.unimi.it/LSR/Item?id=818
By combining the tonic note with the type and position of the right-most accidental sign in the key signature, I could determine both the current key and whether it was major or minor. (I guess I should allow for other modes as well, hmmm...) See the code below which also now handles C Major / A Minor, and (for now) replaces the key signature stencil with the name of the key, as described here: http://lilypond.org/doc/v2.16/Documentation/notation/modifying-stencils A variation on this could come in handy if you wanted to automatically print the textual name of the key above the key signature. Any advice or comments welcome. There are probably ways to improve this or do it better. Cheers, -Paul %%% Begin snippet \version "2.16.0" #(define Custom_key_sig_engraver (make-engraver (acknowledgers ((key-signature-interface engraver grob source-engraver) (let* ( (context (ly:translator-context engraver)) (tonic-pitch (ly:context-property context 'tonic)) (tonic-semi (modulo (ly:pitch-semitones tonic-pitch) 12)) (acclist (ly:grob-property grob 'alteration-alist)) (accsign (if (null? acclist) 0 (cdr (list-ref acclist 0)))) (psn (if (null? acclist) 0 (car (list-ref acclist 0)))) ) (cond ((= accsign 0) (if (= tonic-semi 0) (ly:grob-set-property! grob 'text #{ \markup {C Major} #}) ;; C Major (ly:grob-set-property! grob 'text #{ \markup {A Minor} #}) ;; A Minor )) ((= accsign 1/2) ;; SHARP KEYS (cond ((= psn 3) (if (= tonic-semi 7) (ly:grob-set-property! grob 'text #{ \markup {G Major} #}) ;; G Major (ly:grob-set-property! grob 'text #{ \markup {E Minor} #}) ;; E Minor )) ((= psn 0) (if (= tonic-semi 2) (ly:grob-set-property! grob 'text #{ \markup {D Major} #}) ;; D Major (ly:grob-set-property! grob 'text #{ \markup {B Minor} #}) ;; B Minor )) ((= psn 4) (if (= tonic-semi 9) (ly:grob-set-property! grob 'text #{ \markup {A Major} #}) ;; A Major (ly:grob-set-property! grob 'text #{ \markup {Fis Minor} #}) ;; Fis Minor )) ((= psn 1) (if (= tonic-semi 4) (ly:grob-set-property! grob 'text #{ \markup {E Major} #}) ;; E Major (ly:grob-set-property! grob 'text #{ \markup {Cis Minor} #}) ;; Cis Minor )) ((= psn 5) (if (= tonic-semi 11) (ly:grob-set-property! grob 'text #{ \markup {B Major} #}) ;; B Major (ly:grob-set-property! grob 'text #{ \markup {Gis Minor} #}) ;; Gis Minor )) ((= psn 2) (if (= tonic-semi 6) (ly:grob-set-property! grob 'text #{ \markup {Fis Major} #}) ;; Fis Major (ly:grob-set-property! grob 'text #{ \markup {Dis Minor} #}) ;; Dis Minor )) ((= psn 6) (if (= tonic-semi 1) (ly:grob-set-property! grob 'text #{ \markup {Cis Major} #}) ;; Cis Major (ly:grob-set-property! grob 'text #{ \markup {Ais Minor} #}) ;; Ais Minor )) ) ) ((= accsign -1/2) ;; FLAT KEYS (cond ((= psn 6) (if (= tonic-semi 5) (ly:grob-set-property! grob 'text #{ \markup {F Major} #}) ;; F Major (ly:grob-set-property! grob 'text #{ \markup {D Minor} #}) ;; D Minor )) ((= psn 2) (if (= tonic-semi 10) (ly:grob-set-property! grob 'text #{ \markup {Bes Major} #}) ;; Bes Major (ly:grob-set-property! grob 'text #{ \markup {G Minor} #}) ;; G Minor )) ((= psn 5) (if (= tonic-semi 3) (ly:grob-set-property! grob 'text #{ \markup {Ees Major} #}) ;; Ees Major (ly:grob-set-property! grob 'text #{ \markup {C Minor} #}) ;; C Minor )) ((= psn 1) (if (= tonic-semi 8) (ly:grob-set-property! grob 'text #{ \markup {Aes Major} #}) ;; Aes Major (ly:grob-set-property! grob 'text #{ \markup {F Minor} #}) ;; F Minor )) ((= psn 4) (if (= tonic-semi 1) (ly:grob-set-property! grob 'text #{ \markup {Des Major} #}) ;; Des Major (ly:grob-set-property! grob 'text #{ \markup {Bes Minor} #}) ;; Bes Minor )) ((= psn 0) (if (= tonic-semi 6) (ly:grob-set-property! grob 'text #{ \markup {Ges Major} #}) ;; Ges Major (ly:grob-set-property! grob 'text #{ \markup {Ees Minor} #}) ;; Ees Minor )) ((= psn 3) (if (= tonic-semi 11) (ly:grob-set-property! grob 'text #{ \markup {Ces Major} #}) ;; Ces Major (ly:grob-set-property! grob 'text #{ \markup {Aes Minor} #}) ;; Aes Minor )) ) ) ) ))))) \layout { \context { \Staff \consists \Custom_key_sig_engraver \override KeySignature #'stencil = #ly:text-interface::print } } \new Staff { \key c \major c'1 \key a \minor a'1 } << \new Staff { \key g \major g'1 \key e \minor e'1 } \new Staff { \key d \major d'1 \key b \minor b'1 } \new Staff { \key a \major a'1 \key fis \minor fis'1 } \new Staff { \key e \major e'1 \key cis \minor cis'1 } \new Staff { \key b \major b'1 \key gis \minor gis'1 } \new Staff { \key fis \major fis'1 \key dis \minor dis'1 } \new Staff { \key cis \major cis'1 \key ais \minor ais'1 } >> << \new Staff { \key f \major f'1 \key d \minor d'1 } \new Staff { \key bes \major bes'1 \key g \minor g'1 } \new Staff { \key ees \major ees'1 \key c \minor c'1 } \new Staff { \key aes \major aes'1 \key f \minor f'1 } \new Staff { \key des \major des'1 \key bes \minor bes'1 } \new Staff { \key ges \major ges'1 \key ees \minor ees'1 } \new Staff { \key ces \major ces'1 \key aes \minor aes'1 } >> _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user