Rendering chords in "Danish" style

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Rendering chords in "Danish" style

Michael Bisgaard Olesen
Hi there.

I recently stumbled upon this great project and thought I'd use it to
render the score of a little melody with chords and lyrics.

The song is in Danish and I'd like the  to be rendered in the traditional
Danish style. I don't know if this is Danish only (could be Scandinavian?),
but I'll just refer to it as D-style. In any case, it doesn't seem to be
supported by lilypond. So I took a look at the source and found a way to
make it render (almost) like I want it.

The "D-style" is a mix between default and semi-german:
- The chord name is like semi-german.
- The note name is like default but lower case (and "h" instead of "b" like

I'd like to try and add support for "D-style" in lilypond, so I made the
following patch with my change:

 scm/chord-name.scm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/scm/chord-name.scm b/scm/chord-name.scm
index 3ec61b435a..0f962d32b4 100644
--- a/scm/chord-name.scm
+++ b/scm/chord-name.scm
@@ -137,6 +137,18 @@ note names are capitalized."
            (list-ref '( "ses" "s" "" "is" "isis") (+ 2 (cdr n-a)))
            (list-ref '("eses" "es" "" "is" "isis") (+ 2 (cdr n-a)))))))))

+(define-safe-public (note-name->danish-markup pitch lowercase?)
+  (let* ((name (ly:pitch-notename pitch))
+         (alt-semitones (pitch-alteration-semitones pitch))
+         (n-a (if (member (cons name alt-semitones) `((6 . -1) (6 . -2)))
+                  (cons 7 (+ 1 alt-semitones))
+                  (cons name alt-semitones))))
+  (make-line-markup
+   (list
+    (make-simple-markup
+     (list-ref '("c" "d" "e" "f" "g" "a" "h" "b") (car n-a)))
+    (accidental->markup-italian (ly:pitch-alteration pitch))))))
 (define ((chord-name->italian-markup french?) pitch lowercase?)
   "Return pitch markup for @var{pitch}, using Italian/@/French note names.
 If @var{re-with-eacute} is set to @code{#t}, french `ré' is returned for

This is clearly just a draft, but I'd like guidance on what it would take
to get it included. From skimming the docs, it looks like posting here is
the right way to start this discussion. As I'm completely new here, I
apologize if it isn't.

For reference, this is the melody:

melody = \relative g' {
    \key g \major
    \time 4/4
    \partial 4
    b d8 g, a4 c8 fis,
    g4 b2 fis4
    g b a e
    fis2 r4 e4 \break
    fis g a b8 c
    d4. c8 b4 a8 b
    c4 b8 a8 ~ a8 g8 fis4
    g2 r4 \bar "|."

text = \lyricmode {
  Jeg els -- ker den bro -- ge -- de ver -- den
  trods al dens nød og stid;
  for mig er jord - en skøn end -- nu
  som i pa -- tri -- ar -- ker -- nes tid.

harmonies = \chordmode {
  g2 d/fis e1:min c2 a d1
  c2 d/fis g/b c g/d d4 d:7 g2

\score {
    \new ChordNames {
    \new Voice = "one" {
    \new Lyrics \lyricsto "one" \text
  \layout {
    \context {
      chordRootNamer = #(chord-name->german-markup #f)
      chordNoteNamer = #note-name->danish-markup
  \midi { \tempo 2 = 60 }

There are other changes that I'd like to make, but might be out of scope or
the change above:
- Use a different font (in italics) for the chords.
- Render # and b as superscript with reduced size.
- Render 7 as non-superscript.
- Have "d d7" rendered as "D -7" (instead of "D D7") if it's within the
same measure. Same for "c c/g"; should be "C -/g".