- tonic-markup except-markup sep-markup
- (make-normal-size-super-markup
- (make-line-markup (list pref-markup suff-markup)))
- b+i-markup))))
-
-(define (chord::additions-american steps)
- (let ((evens (filter-list (lambda (x) (!= 0 (modulo (cadr x) 2))) steps))
- ;we let all the unevens pass for now, we'll fix that later.
- (unevens
- (filter-list (lambda (x)
- (let ((n (cadr x)) (a (caddr x)))
- (or (and (= 6 n) (!= -1 a))
- (and (< 3 n)
- (= 0 (modulo n 2))))))
- steps))
- (highest (let ((h (car (last-pair steps))))
- (if (and (not (null? h))
- (or (> 4 (cadr h))
- (!= 0 (caddr h))))
- (list (list h))
- '()))))
- (uniq-list (sort (apply append evens unevens highest)
- pitch::<))))
-
- ;; American style chordnames use no "no",
- ;; but otherwise very similar to banter for now
- (define-public (chord::name-american tonic exception-part unmatched-steps
- bass-and-inversion steps)
- (let ((additions (chord::additions-american unmatched-steps))
- (subtractions (chord::subtractions unmatched-steps)))
- (chord::inner-name-american tonic exception-part additions subtractions
- bass-and-inversion steps)))
-
- ;;; Jazz style
- ;;;
-;; Jazz chords, by Atte Andr'e Jensen <atte@post.com>
-;; Complete rewrite by Amelie Zapf (amy@loueymoss.com)
-
-;; FIXME: identical to chord::exception-alist-american, apart from commented
-;; dim chord. should merge.
-(define-public chord::exception-alist-jazz
- `(
- (((0 . 0)) . ,empty-markup)
- (((0 . 0) (2 . -1)) . ,(make-simple-markup "m"))
-
- ;; these should probably be normal-size? --jcn
- ;;(((0 . 0) (4 . 0)) . ,(make-super-markup (make-simple-markup "5 ")))
- ;;(((0 . 0) (1 . 0) (4 . 0)) . ,(make-super-markup (make-simple-markup "2 ")))
-
- (((0 . 0) (4 . 0)) . ,(make-normal-size-super-markup (make-simple-markup "5 ")))
- (((0 . 0) (1 . 0) (4 . 0)) . ,(make-normal-size-super-markup (make-simple-markup "2 ")))
-
- ;;choose your symbol for the fully diminished chord
- ;;(((0 . 0) (2 . -1) (4 . -1) (6 . -2)) . ,(make-simple-markup "dim"))
- (((0 . 0) (2 . -1) (4 . -1) (6 . -2)) . ,(make-line-markup (list (make-simple-markup "") (make-super-markup (make-simple-markup "o")))))
- ))
-
-;; FIXME: rather similar to step->markup-american. should merge.
-(define (step->markup-jazz pitch)
- (case (cadr pitch)
- ((6) (case (caddr pitch)
- ((-2) (make-line-markup (list (accidental->markup -1) (make-simple-markup "7"))))
- ((-1) (make-simple-markup "7"))
- ;;Pick your favorite maj7
- ((0) mathm-markup-object) ;;a white triangle
- ;;((0) mathn-markup-object) ;;a black triangle
- ;;((0) (make-simple-markup "maj7")) ;;good old maj7
- ((1) (make-line-markup (list (accidental->markup 1) (make-simple-markup "7"))))
- ((2) (make-line-markup (list (accidental->markup 2) (make-simple-markup "7"))))))
- ((4) (case (caddr pitch)
- ((-2) (make-line-markup (list (accidental->markup -2) (make-simple-markup "5"))))
- ;;choose your symbol for the diminished fifth
- ;;((-1) (make-simple-markup "-5"))
- ((-1) (make-line-markup (list (accidental->markup -1) (make-simple-markup "5"))))
- ((0) empty-markup)
- ;;choose your symbol for the augmented fifth
- ;;((1) (make-simple-markup "aug"))
- ((1) (make-line-markup (list (accidental->markup 1) (make-simple-markup "5"))))
- ;;((1) (make-simple-markup "+5"))
- ((2) (make-line-markup (list (accidental->markup 2) (make-simple-markup "5"))))))
- (else (if (and (= (car pitch) 0)
- (= (cadr pitch) 3)
- (= (caddr pitch) 0))
- (make-simple-markup "sus4")
- (step->markup-accidental pitch)))))
-
-;; FIXME: identical to chord::additions->markup-american,
-;; except for -jazz / -american suffixes on calls
-(define (chord::additions->markup-jazz additions subtractions)
- (if (pair? additions)
- ;; I don't like all this reasoning here, when we're actually typesetting.
- (if(and(pair? (cdr additions)) ;a further addition left over
- (or(and(= 0 (caddr(car additions))) ;this addition natural
- (not(= 6 (cadr(car additions)))))
- (and(= -1 (caddr(car additions)))
- (= 6 (cadr(car additions)))))
- (or(and(= 0 (caddr(cadr additions))) ;the following addition natural
- (not(= 6 (cadr(cadr additions)))))
- (and(= -1 (caddr(cadr additions)))
- (= 6 (cadr(cadr additions)))))
- (or(and(= (car(car additions)) (car(cadr additions))) ;both a third apart
- (= 2 (- (cadr(cadr additions)) (cadr(car additions)))))
- (and(= 1 (- (car(cadr additions)) (car(car additions))))
- (= 5 (- (cadr(car additions)) (cadr(cadr additions))))))
- (or(null? subtractions) ;this or clause protects the "adds"
- (and (pair? subtractions)
- (or (< (car(cadr additions)) (car(car subtractions)))
- (and(= (car(cadr additions)) (car(car subtractions)))
- (< (cadr(cadr additions)) (cadr(car subtractions))))))))
- (chord::additions->markup-jazz (cdr additions) subtractions)
- (make-line-markup
- (list
- (let ((step (step->markup-jazz (car additions))))
- (if (or (pair? (cdr additions))
- (pair? subtractions))
- (if (and (pair? (cdr additions))
- (or(< 3 (- (cadr(cadr additions)) (cadr(car additions))))
- (and(< 0 (- (car(cadr additions)) (car(car additions))))
- (> 4 (- (cadr(car additions)) (cadr(cadr additions)))))))
- (make-line-markup (list step (make-simple-markup " add")))
- ;; tweak your favorite separator here
- ;; (make-line-markup (list step (make-simple-markup "/")))
- (make-line-markup (list step (make-simple-markup " "))))
- step))
- (chord::additions->markup-jazz (cdr additions) subtractions))))
- empty-markup))
-
-;; FIXME: identical to chord::additions->markup-american.
-;; except for -jazz / -american suffixes on calls
-(define (chord::inner-name-jazz tonic exception-part additions subtractions
- bass-and-inversion steps)
- (let* ((tonic-markup (pitch->chord-name-markup-banter tonic steps))
- (except-markup (if exception-part exception-part empty-markup))
- (sep-markup (if (and (string-match "super" (format "~s" except-markup))
- (or (pair? additions)
- (pair? subtractions)))
- (make-super-markup (make-simple-markup "/"))
- empty-markup))
- ;;this list contains all the additions that go "in line"
- (prefixes
- (filter-list
- (lambda (x)
- (let ((o (car x)) (n (cadr x)) (a (caddr x)))
- (and (not (and (= 0 o) (= 2 n))) ;gets rid of unwanted thirds
- ;;change this if you want it differently
- (not (and (= 0 o) (= 3 n) (= 0 a))) ;sus4
- (not (and (= 0 o) (= 4 n) (!= 0 a)))))) ;alt5
- additions))
- ;;this list contains all the additions that are patched onto the end
- ;;of the chord symbol, usually sus4 and altered 5ths.
- (suffixes
- ;;take out the reverse if it bothers you in a pathological chord
- (reverse
- (filter-list
- (lambda (x)
- (let ((o (car x)) (n (cadr x)) (a (caddr x)))
- (and(not (and (= 0 o) (= 2 n))) ;gets rid of unwanted thirds
- ;;change this correspondingly
- (or(and (= 0 o) (= 3 n) (= 0 a)) ;sus4
- (and (= 0 o) (= 4 n) (!= 0 a)))))) ;alt5
- additions)))
- (relevant-subs (filter-list
- (lambda (x) ;catches subtractions higher than 5th
- (let((o (car x)) (n (cadr x)))
- (or (> o 0)
- (> n 4))))
- subtractions))
- (pref-markup (chord::additions->markup-jazz prefixes relevant-subs))
- (suff-markup (chord::additions->markup-jazz suffixes relevant-subs))
- (b+i-markup (chord::bass-and-inversion->markup-banter bass-and-inversion)))
- (make-line-markup
- (list
- tonic-markup except-markup sep-markup
- (make-normal-size-super-markup
- (make-line-markup (list pref-markup suff-markup)))
- b+i-markup))))
-
-(define (chord::name-jazz tonic exception-part unmatched-steps
- bass-and-inversion steps)
- (let ((additions (chord::additions-american unmatched-steps))
- (subtractions (chord::subtractions unmatched-steps)))
- (chord::inner-name-jazz tonic exception-part additions subtractions
- bass-and-inversion steps)))
-