I write a songbook in lilypond and want to use Czech chords. Czech chords are almost the same as German chords are. (B chord is "H" and Bb chord is "B".) Moreover, I want minor chords to be small letters and not capital letters with "m". (E minor chord should be "e" and not "Em".). I have already solved these problems using \germanChords and \set chordNameLowercaseMinor = ##t commands.
However, there is a third problem. I want the chords with accidentals to be written in a way that German notes are. Instead of "F#", I want "Fis". Therefore Eb minor chord should look like "es" and not like "Ebmi". ("#" adds the "-is" suffix and b adds the "-es" suffix with the exeption of "e flat" = "es", "a flat" = "as" and "b flat" = "b").
I found in the lilypond manual, that this is solvable with the \set chordRootNamer command, however I did not find, how to use it properly.
Than I found this piece of code:
#(define-public (my-note-name->german-markup pitch lowercase?)
(let* ((name (ly:pitch-notename pitch))
(alt-semitones (inexact->exact (round (* (ly:pitch-alteration pitch) 2))))
(n-a (if (member (cons name alt-semitones) `((6 . -1) (6 . -2)))
(cons 7 (+ 1 alt-semitones))
(cons name alt-semitones)))
(basic-list '("c" "d" "e" "f" "g" "a" "h" "b"))
(list-to-use
(if lowercase?
basic-list
(map string-upcase basic-list))))
(make-line-markup
(list
(string-append
(list-ref list-to-use (car n-a))
(if (or (equal? (car n-a) 2) (equal? (car n-a) 5))
(list-ref '( "ses" "s" "" "is" "isis") (+ 2 (cdr n-a)))
(list-ref '("eses" "es" "" "is" "isis") (+ 2 (cdr n-a)))))))))
This kind of helped me with the problem. However now, all chords (including the major chords) are in lowercase. I am able to turn it on and off, but it is an inconvenient way, if your write many songs. I was unable to change it in the way that it changes only suffixes and to leave major chords like capital letters.
Could someone explain me, how this piece of code works and how to change it to change only suffixes of chords?
Thanks,
Vít