lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Intervalic Chord Names


From: Aaron Hill
Subject: Re: Intervalic Chord Names
Date: Wed, 29 Aug 2018 17:36:05 -0700
User-agent: Roundcube Webmail/1.3.6

On 2018-08-29 10:25, Tom Swan wrote:
continued reply... Re: accidentals, yes that will be necessary. Do you
have an idea about how to go about that?

Hi Tom,

Building upon the code from scm/chord-name.scm (and related files) as well as (LSR #750)[1], here is a more complete version of the interval-based chord root namer:

[1]:http://lsr.di.unimi.it/LSR/Item?id=750

```lilypond
    \version "2.18.2"

    #(define (intervalic-namer pitch lowercase?)
      (let ((handle-case (if lowercase? string-downcase (lambda (x) x)))
            (alt (ly:pitch-alteration pitch)))
        (make-line-markup (list
          (make-simple-markup (handle-case
            (vector-ref #("I" "II" "III" "IV" "V" "VI" "VII")
              (ly:pitch-notename pitch))))
          (if (= 0 alt) empty-markup
            (alteration->text-accidental-markup alt))))))

    #(define (intervalic-namer-custom-alts pitch lowercase?)
      (let ((handle-case (if lowercase? string-downcase (lambda (x) x)))
            (alt (ly:pitch-alteration pitch))
            (custom-alts `((,FLAT . "b") (,SHARP . "#"))))
        (make-line-markup (list
          (make-simple-markup (handle-case
            (vector-ref #("I" "II" "III" "IV" "V" "VI" "VII")
              (ly:pitch-notename pitch))))
          (if (= 0 alt) empty-markup
            (make-small-markup (make-raise-markup 0.7 (make-text-markup
              (ly:assoc-get alt custom-alts "?")))))))))

theChords = \chordmode { c8 d/fis e:m7 f:maj7 g:7 a:m bes:sus4 b:dim }
    \score { << \new ChordNames \chordmode {
      \omit Score.BarNumber
      \override Score.RehearsalMark.self-alignment-X = #-1
      \mark "Default naming"
      \theChords \break
      \mark "Interval-based naming"
      \set chordRootNamer = #intervalic-namer
      \theChords \break
      \mark "Lowercase minor"
      \set chordNameLowercaseMinor = ##t
      \theChords \break
      \mark "Custom alterations"
      \set chordRootNamer = #intervalic-namer-custom-alts
      \theChords
    } >> \layout { indent = 0 } }
```

The above namer comes in two flavors, depending on whether you prefer the normal glyphs for alterations or if you want to customize the symbols.

The one thing this does not handle is ensuring the tonic of the current key signature appears as "I". To do that appears to require more work as `chordRootNamer` does not provide access to the context in order to query for the current key. I believe you might need to go down the route of a custom engraver. If you search on this mailing list, there has been prior discussion about supporting the Nashville numbering system (which admittedly is much more than just interval-based naming). But in that thread, there is a lot of potentially relevant material to this topic, such as getting the key signature information into the ChordNames context.

-- Aaron Hill



reply via email to

[Prev in Thread] Current Thread [Next in Thread]