Rendering chords in "Danish" style

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Rendering chords in "Danish" style

Michael Bisgaard Olesen
*(Resending because it didn't seem to go through the first time)*

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 chords 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
semi-german).

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
--
2.20.1

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.

For reference, this is the melody:

melody = \relative g' {
    \key g \major
    \time 4/4
    \partial 4
    a
    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 {
  s4
  g2 d/fis e1:min c2 a d1
  c2 d/fis g/b c g/d d4 d:7 g2
}

\score {
  <<
    \new ChordNames {
      \harmonies
    }
    \new Voice = "one" {
      \melody
    }
    \new Lyrics \lyricsto "one" \text
  >>
  \layout {
    \context {
      \Score
      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".
Reply | Threaded
Open this post in threaded view
|

Re: Rendering chords in "Danish" style

Valentin Villenave-3
On 4/19/20, Michael Bisgaard Olesen <[hidden email]> wrote:
> *(Resending because it didn't seem to go through the first time)*

Greetings,
if you’re subscribed to the -devel list, your messages should go
through immediately. Perhaps your first message got stuck because your
address was not subscribed yet and as such it had to be approved
manually?

> The song is in Danish and I'd like the chords to be rendered in the
> traditional Danish style. I don't know if this is Danish only (could be
> Scandinavian?)

If you can investigate, that would be great. Alternatively, could you
elaborate on what constitutes “Danish” style, and according to which
sources?

More generally, more contributions are always welcome and I happily
encourage you to read some of our Contributor's Guide if you haven’t
already done so:
http://lilypond.org/doc/latest/Documentation/contributor/overview-of-work-flow

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

Hm. You may have noticed the couple of TODOs and FIXMEs I added last
year; the chord naming system is a bit of a mess and I’ve only started
cleaning it up. (There were _three_ different, unrelated methods for
turning a pitch into a text string in LilyPond; now there are only two
and I’m hoping we can factorize that further.)

As I said in these comments in chord-name.scm, there must be a way of
making the notation more flexible and to avoid requiring large chunks
of code duplication like what you did here. One possibility worth
exploring is to take advantage of the note-name->lily-string function
I rewrote (see at the bottom of translation-functions.scm). Actually,
your suggestion might be a good occasion of pursuing the cleanup I had
initiated. Feel free to take a look!

As for the other tweaks you mentioned that could certainly fit into a
predefined variable (see for example property-init.ly) -- but then
again, some sources would be needed to document the existing engraving
practices in Danish/Scandinavian printed music.

Cheers,
V.