Hi Stan, Klaus,

the following snippet does Nashville numbers correctly for the key of C
(except for the rhythmical symbols). In order to adapt this to other
keys we'd need to hand the routine two pitches, the chord root and the
current key, and have it compute the difference between the two, which
is the scale degree. Does anybody know how to do that?

Amy

\version "2.18.2"
% Chords
#(define (note-name->international-markup pitch lowercase?)
   (let* (
       (name (ly:pitch-notename pitch))
       (alt (ly:pitch-alteration pitch))
       (hspace (vector-ref #(0.15 0.15 0.05 0.05 0.15) (+ (* alt 2) 2)))
       (raise (vector-ref #(0.6 0.6 0.65 0.8 0.7) (+ (* alt 2) 2)))
     )
     (make-line-markup
       (list
         (if (= alt 0)
           ;; If it's natural and not b, do nothing
           (make-line-markup (list empty-markup))
           ;; Else add alteration
           (make-line-markup
             (list
               (make-smaller-markup
                 (make-raise-markup raise
                    (make-musicglyph-markup (assoc-get alt
standard-alteration-glyph-name-alist ""))))
               (make-hspace-markup hspace)
         )))
         (make-simple-markup
           (vector-ref #("1" "2" "3" "4" "5" "6" "7") name)
         )
 ))))



nashvilleChords = {
  \set chordRootNamer = #note-name->international-markup
  \unset chordNoteNamer
}

\chords {
  c1 d:m es f:maj7 fis:sus4 g:7 c
  \nashvilleChords
  c1 d:m es f:maj7 fis:sus4 g:7 c
}
%

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to