- (root-markup (name-root root lowercase-root?))
- (add-markups (map (lambda (x) (glue-word-to-step "add" x))
- addition-pitches))
- (filtered-alterations (filter-alterations alteration-pitches))
- (alterations (map name-step filtered-alterations))
- (suffixes (map suffix-modifier->markup suffix-modifiers))
- (prefixes (map prefix-modifier->markup prefix-modifiers))
- (main-markups (filter-main-name main-name))
- (to-be-raised-stuff (markup-join
- (append
- main-markups
- alterations
- suffixes
- add-markups) sep))
- (base-stuff (if (ly:pitch? bass-pitch)
- (list sep (name-note bass-pitch #f))
- '())))
+ (slashsep (ly:context-property context 'slashChordSeparator))
+ (root-markup (name-root root lowercase-root?))
+ (add-pitch-prefix (ly:context-property context 'additionalPitchPrefix))
+ (add-markups (map (lambda (x) (glue-word-to-step add-pitch-prefix x))
+ addition-pitches))
+ (filtered-alterations (filter-alterations alteration-pitches))
+ (alterations (map name-step filtered-alterations))
+ (suffixes (map suffix-modifier->markup suffix-modifiers))
+ (prefixes (map prefix-modifier->markup prefix-modifiers))
+ (main-markups (filter-main-name main-name))
+ (to-be-raised-stuff (markup-join
+ (append
+ main-markups
+ alterations
+ suffixes
+ add-markups) sep))
+ (base-stuff (if (ly:pitch? bass-pitch)
+ (list slashsep (name-note bass-pitch #f))
+ '())))
- (pitches (map (lambda (x) (ly:pitch-diff x root)) (cdr in-pitches)))
- (lowercase-root?
- (and (ly:context-property context 'chordNameLowercaseMinor)
- (let ((third (get-step 3 pitches)))
- (and third (= (ly:pitch-alteration third) FLAT)))))
- (exceptions (ly:context-property context 'chordNameExceptions))
- (exception (assoc-get pitches exceptions))
- (prefixes '())
- (suffixes '())
- (add-steps '())
- (main-name #f)
- (bass-note
- (if (ly:pitch? inversion)
- inversion
- bass))
- (alterations '()))
+ (pitches (map (lambda (x) (ly:pitch-diff x root)) (cdr in-pitches)))
+ (lowercase-root?
+ (and (ly:context-property context 'chordNameLowercaseMinor)
+ (let ((third (get-step 3 pitches)))
+ (and third (= (ly:pitch-alteration third) FLAT)))))
+ (exceptions (ly:context-property context 'chordNameExceptions))
+ (exception (assoc-get pitches exceptions))
+ (prefixes '())
+ (suffixes '())
+ (add-steps '())
+ (main-name #f)
+ (bass-note
+ (if (ly:pitch? inversion)
+ inversion
+ bass))
+ (alterations '()))
- (ignatzek-format-exception root exception bass-note lowercase-root?)
-
- (begin
- ;; no exception.
- ;; handle sus4 and sus2 suffix: if there is a 3 together with
- ;; sus2 or sus4, then we explicitly say add3.
- (map
- (lambda (j)
- (if (get-step j pitches)
- (begin
- (if (get-step 3 pitches)
- (begin
- (set! add-steps (cons (get-step 3 pitches) add-steps))
- (set! pitches (remove-step 3 pitches))))
- (set! suffixes (cons (get-step j pitches) suffixes)))))
- '(2 4))
-
- ;; do minor-3rd modifier.
- (if (and (get-step 3 pitches)
- (= (ly:pitch-alteration (get-step 3 pitches)) FLAT))
- (set! prefixes (cons (get-step 3 pitches) prefixes)))
-
- ;; lazy bum. Should write loop.
- (cond
- ((get-step 7 pitches) (set! main-name (get-step 7 pitches)))
- ((get-step 6 pitches) (set! main-name (get-step 6 pitches)))
- ((get-step 5 pitches) (set! main-name (get-step 5 pitches)))
- ((get-step 4 pitches) (set! main-name (get-step 4 pitches)))
- ((get-step 3 pitches) (set! main-name (get-step 3 pitches))))
-
- (let* ((3-diff? (lambda (x y)
- (= (- (pitch-step y) (pitch-step x)) 2)))
- (split (split-at-predicate
- 3-diff? (remove-uptil-step 5 pitches))))
- (set! alterations (append alterations (car split)))
- (set! add-steps (append add-steps (cdr split)))
- (set! alterations (delq main-name alterations))
- (set! add-steps (delq main-name add-steps))
-
-
- ;; chords with natural (5 7 9 11 13) or leading subsequence.
- ;; etc. are named by the top pitch, without any further
- ;; alterations.
- (if (and
- (ly:pitch? main-name)
- (= 7 (pitch-step main-name))
- (is-natural-alteration? main-name)
- (pair? (remove-uptil-step 7 alterations))
- (reduce (lambda (x y) (and x y)) #t
- (map is-natural-alteration? alterations)))
- (begin
- (set! main-name (last alterations))
- (set! alterations '())))
-
- (ignatzek-format-chord-name
- root prefixes main-name alterations add-steps suffixes bass-note
- lowercase-root?))))))
+ (ignatzek-format-exception root exception bass-note lowercase-root?)
+
+ (begin
+ ;; no exception.
+ ;; handle sus4 and sus2 suffix: if there is a 3 together with
+ ;; sus2 or sus4, then we explicitly say add3.
+ (map
+ (lambda (j)
+ (if (get-step j pitches)
+ (begin
+ (if (get-step 3 pitches)
+ (begin
+ (set! add-steps (cons (get-step 3 pitches) add-steps))
+ (set! pitches (remove-step 3 pitches))))
+ (set! suffixes (cons (get-step j pitches) suffixes)))))
+ '(2 4))
+
+ ;; do minor-3rd modifier.
+ (if (and (get-step 3 pitches)
+ (= (ly:pitch-alteration (get-step 3 pitches)) FLAT))
+ (set! prefixes (cons (get-step 3 pitches) prefixes)))
+
+ ;; lazy bum. Should write loop.
+ (cond
+ ((get-step 7 pitches) (set! main-name (get-step 7 pitches)))
+ ((get-step 6 pitches) (set! main-name (get-step 6 pitches)))
+ ((get-step 5 pitches) (set! main-name (get-step 5 pitches)))
+ ((get-step 4 pitches) (set! main-name (get-step 4 pitches)))
+ ((get-step 3 pitches) (set! main-name (get-step 3 pitches))))
+
+ (let* ((3-diff? (lambda (x y)
+ (= (- (pitch-step y) (pitch-step x)) 2)))
+ (split (split-at-predicate
+ 3-diff? (remove-uptil-step 5 pitches))))
+ (set! alterations (append alterations (car split)))
+ (set! add-steps (append add-steps (cdr split)))
+ (set! alterations (delq main-name alterations))
+ (set! add-steps (delq main-name add-steps))
+
+
+ ;; chords with natural (5 7 9 11 13) or leading subsequence.
+ ;; etc. are named by the top pitch, without any further
+ ;; alterations.
+ (if (and
+ (ly:pitch? main-name)
+ (= 7 (pitch-step main-name))
+ (is-natural-alteration? main-name)
+ (pair? (remove-uptil-step 7 alterations))
+ (reduce (lambda (x y) (and x y)) #t
+ (map is-natural-alteration? alterations)))
+ (begin
+ (set! main-name (last alterations))
+ (set! alterations '())))
+
+ (ignatzek-format-chord-name
+ root prefixes main-name alterations add-steps suffixes bass-note
+ lowercase-root?))))))