4

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

  • 2
    Well, I constructed a MWE and the problem you explained didn't appear. Isn't that what you're looking for? www.lilybin.com/5hvi5s/1 – TiagoPC Oct 1 '18 at 23:20
  • Oh, I see it now. The problem was, that I coppied also the: \set chordRootNamer = #(lambda (pitch lowercase?)(my-note-name->german-markup pitch #t)) command without understanding it. And the part you used: \set chordRootNamer = #my-note-name->german-markup did the job I needed and the rest of the command did the lowercase letters. Thank you very much and thank you also for showing me Lilybin, which I was not aware of. – Vit Henych Oct 2 '18 at 12:15
  • @TiagoPC Would you mind making that an answer? It's great information and deserves to be recognized! – Richard Nov 1 '18 at 20:24
2

The answer is:

\set chordRootNamer = #my-note-name->german-markup

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.