X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Fchord-name.scm;h=c49443f2ef6e719a9e9cceed856fee193eba9e0d;hb=94be68c2aaa1b14486702e0a1faaa9aff08bf73f;hp=6570b49055226433b14bb9a5cb2f63e279fc046c;hpb=969911beb66f7a53f5a47aa7e00dbe3158e70c30;p=lilypond.git diff --git a/scm/chord-name.scm b/scm/chord-name.scm index 6570b49055..c49443f2ef 100644 --- a/scm/chord-name.scm +++ b/scm/chord-name.scm @@ -2,8 +2,8 @@ ;;;; ;;;; source file of the GNU LilyPond music typesetter ;;;; -;;;; (c) 2000--2005 Jan Nieuwenhuizen -;;;; Han-Wen Nienhuys +;;;; (c) 2000--2007 Jan Nieuwenhuizen +;;;; Han-Wen Nienhuys (define (natural-chord-alteration p) "Return the natural alteration for step P." @@ -15,13 +15,14 @@ ;; TODO: make into markup. ;; (define-public (alteration->text-accidental-markup alteration) + (make-smaller-markup (make-raise-markup (if (= alteration FLAT) 0.3 0.6) (make-musicglyph-markup - (string-append "accidentals." (number->string alteration)))))) + (assoc-get alteration standard-alteration-glyph-name-alist ""))))) (define (accidental->markup alteration) "Return accidental markup for ALTERATION." @@ -50,36 +51,39 @@ (vector-ref #("C" "D" "E" "F" "G" "A" "B") (ly:pitch-notename pitch))) (accidental->markup (ly:pitch-alteration pitch))))) +(define (pitch-alteration-semitones pitch) + (inexact->exact (round (* (ly:pitch-alteration pitch) 2)))) + (define-safe-public ((chord-name->german-markup B-instead-of-Bb) pitch) "Return pitch markup for PITCH, using german note names. If B-instead-of-Bb is set to #t real german names are returned. Otherwise semi-german names (with Bb and below keeping the british names) " (let* ((name (ly:pitch-notename pitch)) - (alt (ly:pitch-alteration pitch)) - (n-a (if (member (cons name alt) `((6 . ,FLAT) (6 . ,DOUBLE-FLAT))) - (cons 7 (+ (if B-instead-of-Bb SEMI-TONE 0) alt)) - (cons name alt)))) + (alt-semitones (pitch-alteration-semitones pitch)) + (n-a (if (member (cons name alt-semitones) `((6 . -1) (6 . -2))) + (cons 7 (+ (if B-instead-of-Bb 1 0) alt-semitones)) + (cons name alt-semitones)))) (make-line-markup (list (make-simple-markup (vector-ref #("C" "D" "E" "F" "G" "A" "H" "B") (car n-a))) (make-normal-size-super-markup - (accidental->markup (cdr n-a))))))) + (accidental->markup (/ (cdr n-a) 2))))))) (define-safe-public (note-name->german-markup pitch) (let* ((name (ly:pitch-notename pitch)) - (alt (ly:pitch-alteration pitch)) - (n-a (if (member (cons name alt) `((6 . ,FLAT) (6 . ,DOUBLE-FLAT))) - (cons 7 (+ SEMI-TONE alt)) - (cons name alt)))) + (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 (string-append (list-ref '("c" "d" "e" "f" "g" "a" "h" "b") (car n-a)) (if (or (equal? (car n-a) 2) (equal? (car n-a) 5)) - (list-ref '( "ses" "s" "" "is" "isis") (+ 2 (/ (cdr n-a) 2))) - (list-ref '("eses" "es" "" "is" "isis") (+ 2 (/ (cdr n-a) 2))))))))) + (list-ref '( "ses" "s" "" "is" "isis") (+ 2 (cdr n-a))) + (list-ref '("eses" "es" "" "is" "isis") (+ 2 (cdr n-a))))))))) (define-public ((chord-name->italian-markup re-with-eacute) pitch) "Return pitch markup for PITCH, using italian/french note names.