lilypond-user
[Top][All Lists]
Advanced

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

Re: chord names


From: Klaus Blum
Subject: Re: chord names
Date: Sat, 11 Feb 2017 14:29:19 -0700 (MST)

Hi Joram, 


Noeck wrote
> Is it correct that
> this function only works for "simple chords" like F# Fm and not in
> combination with numbers, F7 F9? At least that's what I get here.

that's strange... I've tested it with 2.19.37 and it worked - see below. 
(In my last post, comments in the code were messed up by unwanted line
breaks, I hope this time it works.)

AFAIK chordRootNamer only affects the appearance of the chord root, before
any signs/numbers/letters are added for options. 

%------------------------------------------------------------------------
#(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)))
           )

     (if (>= alt 0)
         (make-line-markup
          (list
           (make-simple-markup
            (if lowercase?
                (vector-ref #("c" "d" "e" "f" "g" "a" "b") name)
                (vector-ref #("C" "D" "E" "F" "G" "A" "B") name)
                )
            )
           (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-hspace-markup hspace)
                 (make-tiny-markup (make-raise-markup raise    
                 ;make-tiny-markup instead of make-smaller-markup
                                        (make-musicglyph-markup
                                         (assoc-get alt
standard-alteration-glyph-name-alist ""))))
                 ))
               )))
         (make-line-markup
          (list
           (make-simple-markup
            (if lowercase?
                (vector-ref #("c" "d" "e" "f" "g" "a" "b") name)
                (vector-ref #("C" "D" "E" "F" "G" "A" "B") name)
                )
            )
           (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-hspace-markup hspace)
                 (make-tiny-markup (make-raise-markup raise    
                 ;make-tiny-markup instead of make-smaller-markup
                                        (make-musicglyph-markup
                                         (assoc-get alt
standard-alteration-glyph-name-alist ""))))
                 ))
               )))
         )
     )
   )

internationalChords = {
  \set Staff.chordRootNamer = #note-name->international-markup
  % \unset Staff.chordNoteNamer
}

\new ChordNames \chordmode {
  as a ais bes b bis bes:m bis:m bes:9 bis:9 as/bes
  \internationalChords
  as a ais bes b bis bes:m bis:m bes:9 bis:9 as/bes
}
%------------------------------------------------------------------------

Cheers, 
Klaus



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/chord-names-tp199985p200012.html
Sent from the User mailing list archive at Nabble.com.



reply via email to

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