2 ;;; chord-name.scm -- Compile chord name
4 ;;; source file of the GNU LilyPond music typesetter
6 ;;; (c) 2000--2001 Jan Nieuwenhuizen <janneke@gnu.org>
18 ;; (octave notename accidental)
22 ;; text: scm markup text -- see font.scm and input/test/markup.ly
27 ;; * clean split of bass/banter/american stuff
28 ;; * text definition is rather ad-hoc
29 ;; * do without format module
30 ;; * finish and check american names
31 ;; * make notename (tonic) configurable from lilypond
32 ;; * fix append/cons stuff in inner-name-banter
36 (define chord::names-alist-banter '())
37 (set! chord::names-alist-banter
43 (((0 . 0) (2 . 0)) . #f)
45 (((0 . 0) (2 . -1)) . ("m"))
47 (((0 . 0) (1 . 0) (4 . 0)) . ("" (super "2")))
49 (((0 . 0) (3 . 0) (4 . 0)) . ("" (super "4")))
51 (((0 . 0) (2 . -1) (4 . -1)) . ("dim"))
53 (((0 . 0) (2 . -1) (4 . -1) (6 . -2)) . ("" (super "o")))
55 (((0 . 0) (2 . -1) (4 . -1) (6 . -2) (1 . -1)) . ("dim" (super "9")))
56 (((0 . 0) (2 . -1) (4 . -1) (6 . -2) (1 . -1) (3 . -1)) . ("dim" (super "11")))
58 chord::names-alist-banter))
63 (define (accidental->text acc)
66 (list '(music (font-relative-size . -2))
67 (string-append "accidentals-" (number->string acc)))))
69 (define (accidental->text-super acc)
72 (cons 'super (list (accidental->text acc)))))
74 (define (accidental->text-sub acc)
77 (cons sub (list accidental->text acc))))
80 (define (pitch->note-name pitch)
81 (cons (cadr pitch) (caddr pitch)))
83 (define (pitch->text pitch)
85 (make-string 1 (integer->char (+ (modulo (+ (cadr pitch) 2) 7) 65)))
86 (accidental->text-super (caddr pitch))))
89 ;;; Hooks to override chord names and note names,
90 ;;; see input/tricks/german-chords.ly
92 (define (pitch->text-banter pitch)
95 ;; We need also steps, to allow for Cc name override,
96 ;; see input/test/Cc-chords.ly
97 (define (pitch->chord-name-text-banter pitch steps)
98 (pitch->text-banter pitch))
100 (define (pitch->note-name-text-banter pitch)
101 (pitch->text-banter pitch))
103 (define (step->text pitch)
105 (number->string (+ (cadr pitch) (if (= (car pitch) 0) 1 8)))
113 (define (step->text-banter pitch)
114 (if (= (cadr pitch) 6)
123 (define pitch::semitone-vec (list->vector '(0 2 4 5 7 9 11)))
125 (define (pitch::semitone pitch)
126 (+ (* (car pitch) 12)
127 (vector-ref pitch::semitone-vec (modulo (cadr pitch) 7))
130 (define (pitch::transpose pitch delta)
131 (let ((simple-octave (+ (car pitch) (car delta)))
132 (simple-notename (+ (cadr pitch) (cadr delta))))
133 (let ((octave (+ simple-octave (quotient simple-notename 7)))
134 (notename (modulo simple-notename 7)))
135 (let ((accidental (- (+ (pitch::semitone pitch) (pitch::semitone delta))
136 (pitch::semitone `(,octave ,notename 0)))))
137 `(,octave ,notename ,accidental)))))
139 (define (pitch::diff pitch tonic)
140 (let ((simple-octave (- (car pitch) (car tonic)))
141 (simple-notename (- (cadr pitch) (cadr tonic))))
142 (let ((octave (+ simple-octave (quotient simple-notename 7)
143 (if (< simple-notename 0) -1 0)))
144 (notename (modulo simple-notename 7)))
145 (let ((accidental (- (pitch::semitone pitch)
146 (pitch::semitone tonic)
147 (pitch::semitone `(,octave ,notename 0)))))
148 `(,octave ,notename ,accidental)))))
150 (define (pitch::note-pitch pitch)
151 (+ (* (car pitch) 7) (cadr pitch)))
154 (define (write-me n x)
163 (define (chord::text? text)
164 (not (or (not text) (empty? text) (unspecified? text))))
166 ;; recursively remove '() #f, and #<unspecified> from text
167 (define (chord::text-cleanup dirty)
169 (let ((r (car dirty)))
171 (cons (if (pair? r) (chord::text-cleanup r) r)
172 (chord::text-cleanup (cdr dirty)))
173 (chord::text-cleanup (cdr dirty))))
174 (if (chord::text? dirty)
178 (define (chord::text-append l . r)
179 (if (not (chord::text? r))
181 (if (not (chord::text? l))
185 (define (chord::step tonic pitch)
186 (- (pitch::note-pitch pitch) (pitch::note-pitch tonic)))
188 ;; text: list of word
189 ;; word: string + optional list of property
190 ;; property: align, kern, font (?), size
192 (define chord::minor-major-vec (list->vector '(0 -1 -1 0 -1 -1 0)))
194 ;; compute the relative-to-tonic pitch that goes with 'step'
195 (define (chord::step-pitch tonic step)
196 ;; urg, we only do this for thirds
197 (if (= (modulo step 2) 0)
199 (let loop ((i 1) (pitch tonic))
203 pitch `(0 2 ,(vector-ref chord::minor-major-vec
204 ;; -1 (step=1 -> vector=0) + 7 = 6
205 (modulo (+ i 6) 7)))))))))
207 ;; find the pitches that are not part of `normal' chord
208 (define (chord::additions chord-pitches)
209 (let ((tonic (car chord-pitches)))
210 ;; walk the chord steps: 1, 3, 5
211 (let loop ((step 1) (pitches chord-pitches) (additions '()))
213 (let* ((pitch (car pitches))
214 (p-step (+ (- (pitch::note-pitch pitch)
215 (pitch::note-pitch tonic))
217 ;; pitch is an addition if
219 ;; it comes before this step or
221 ;; its step is even or
222 (= (modulo p-step 2) 0)
223 ;; has same step, but different accidental or
225 (not (equal? pitch (chord::step-pitch tonic step))))
226 ;; is the last of the chord and not one of base thirds
228 (= (length pitches) 1)))
229 (loop step (cdr pitches) (cons pitch additions))
231 (loop step (cdr pitches) additions)
232 (loop (+ step 2) pitches additions))))
233 (reverse additions)))))
235 ;; find the pitches that are missing from `normal' chord
236 (define (chord::subtractions chord-pitches)
237 (let ((tonic (car chord-pitches)))
238 (let loop ((step 1) (pitches chord-pitches) (subtractions '()))
240 (let* ((pitch (car pitches))
241 (p-step (+ (- (pitch::note-pitch pitch)
242 (pitch::note-pitch tonic))
244 ;; pitch is an subtraction if
245 ;; a step is missing or
247 (loop (+ step 2) pitches
248 (cons (chord::step-pitch tonic step) subtractions))
249 ;; there are no pitches left, but base thirds are not yet done and
251 (= (length pitches) 1))
252 ;; present pitch is not missing step
254 (loop (+ step 2) pitches subtractions)
255 (loop (+ step 2) pitches
256 (cons (chord::step-pitch tonic step) subtractions)))
258 (loop (+ step 2) (cdr pitches) subtractions)
259 (loop step (cdr pitches) subtractions)))))
260 (reverse subtractions)))))
263 (define (chord::additions->text-banter additions subtractions)
264 (if (pair? additions)
268 (cons 'super (step->text-banter (car additions)))
269 (if (or (pair? (cdr additions))
270 (pair? subtractions))
272 (chord::additions->text-banter (cdr additions) subtractions))
275 (define (chord::subtractions->text-banter subtractions)
276 (if (pair? subtractions)
281 (cons 'super (step->text-banter (car subtractions)))
282 (if (pair? (cdr subtractions))
284 (chord::subtractions->text-banter (cdr subtractions)))
288 (define (chord::bass-and-inversion->text-banter bass-and-inversion)
289 (if (and (pair? bass-and-inversion)
290 (or (car bass-and-inversion)
291 (cdr bass-and-inversion)))
292 (list "/" (if (car bass-and-inversion)
293 (pitch->note-name-text-banter
294 (car bass-and-inversion))
295 (pitch->note-name-text-banter
296 (cdr bass-and-inversion)))
301 ;; Combine tonic, exception-part of chord name,
302 ;; additions, subtractions and bass or inversion into chord name
303 (define (chord::inner-name-banter tonic exception-part additions subtractions
304 bass-and-inversion steps)
310 (pitch->chord-name-text-banter tonic steps)
312 ;; why does list->string not work, format seems only hope...
313 (if (and (string-match "super" (format "~s" exception-part))
314 (or (pair? additions)
315 (pair? subtractions)))
317 (chord::additions->text-banter additions subtractions)
318 (chord::subtractions->text-banter subtractions)
319 (chord::bass-and-inversion->text-banter bass-and-inversion)))))
321 (define (chord::name-banter tonic exception-part unmatched-steps
322 bass-and-inversion steps)
323 (let ((additions (chord::additions unmatched-steps))
324 (subtractions (chord::subtractions unmatched-steps)))
325 (chord::inner-name-banter tonic exception-part additions subtractions
326 bass-and-inversion steps)))
329 (define (c++-pitch->scm p)
331 (list (pitch-octave p) (pitch-notename p) (pitch-alteration p))
334 (define (chord::name-banter tonic exception-part unmatched-steps
335 bass-and-inversion steps)
336 (let ((additions (chord::additions unmatched-steps))
337 (subtractions (chord::subtractions unmatched-steps)))
338 (chord::inner-name-banter tonic exception-part additions subtractions
339 bass-and-inversion steps)))
341 (define (chord::restyle name style)
342 (ly-eval (string->symbol
343 (string-append (symbol->string name)
344 (symbol->string style)))))
346 ;; check exceptions-alist for biggest matching part of try-steps
347 ;; return (MATCHED-EXCEPTION . UNMATCHED-STEPS)
348 (define (chord::exceptions-lookup-helper
349 exceptions-alist try-steps unmatched-steps exception-part)
350 (if (pair? try-steps)
351 ;; FIXME: junk '(0 . 0) from exceptions lists
353 ;; FIXME: either format exceptions list as real pitches, ie,
354 ;; including octave '((0 2 -1) ..), or drop octave
355 ;; from rest of calculations,
357 (map (lambda (x) (pitch->note-name x))
358 (append '((0 0 0)) try-steps))
361 (chord::exceptions-lookup-helper
362 #f '() unmatched-steps (cdr entry))
363 (let ((r (reverse try-steps)))
364 (chord::exceptions-lookup-helper
367 (cons (car r) unmatched-steps) #f))))
368 (cons exception-part unmatched-steps)))
370 ;; return (MATCHED-EXCEPTION . BASE-CHORD-WITH-UNMATCHED-STEPS)
371 ;; BASE-CHORD-WITH-UNMATCHED-STEPS always includes (tonic 3 5)
372 (define (chord::exceptions-lookup style steps)
373 (let* ((result (chord::exceptions-lookup-helper
374 (chord::restyle 'chord::names-alist- style)
376 (exception-part (car result))
377 (unmatched-steps (cdr result))
378 (matched-steps (if (= (length unmatched-steps) 0)
380 (+ 1 (- (length steps)
381 (length unmatched-steps)))))
382 (unmatched-with-1-3-5
383 (append (do ((i matched-steps (- i 1))
384 (base '() (cons `(0 ,(* (- i 1) 2) 0) base)))
388 (list exception-part unmatched-with-1-3-5)))
391 (define (chord::name->text style tonic steps bass-and-inversion)
392 (let* ((lookup (chord::exceptions-lookup style steps))
393 (exception-part (car lookup))
394 (unmatched-steps (cadr lookup)))
395 ((chord::restyle 'chord::name- style)
396 tonic exception-part unmatched-steps bass-and-inversion steps)))
400 ;; Check for each subset of chord, full chord first, if there's a
401 ;; user-override. Split the chord into user-overridden and to-be-done
402 ;; parts, complete the missing user-override matched part with normal
403 ;; chord to be name-calculated.
405 ;; CHORD: (pitches (bass . inversion))
406 (define (default-chord-name-function style chord)
407 (let* ((pitches (map c++-pitch->scm (car chord)))
408 (modifiers (cdr chord))
409 (bass-and-inversion (if (pair? modifiers)
410 (cons (c++-pitch->scm (car modifiers))
411 (c++-pitch->scm (cdr modifiers)))
413 (diff (pitch::diff '(0 0 0) (car pitches)))
414 (steps (if (cdr pitches) (map (lambda (x)
415 (pitch::transpose x diff))
418 (chord::name->text style (car pitches) steps bass-and-inversion)))
427 ;; NOTE: Duplicates of chord names defined elsewhere occur in this list
428 ;; in order to prevent spurious superscripting of various chord names,
429 ;; such as maj7, maj9, etc.
431 ;; See input/test/american-chords.ly
433 ;; James Hammons, <jlhamm@pacificnet.net>
436 ;; DONT use non-ascii characters, even if ``it works'' in Windows
438 (define chord::names-alist-american '())
440 (set! chord::names-alist-american
444 (((0 . 0) (2 . 0)) . #f)
446 (((0 . 0) (4 . 0)) . ("5"))
448 (((0 . 0) (2 . -1)) . ("m"))
449 (((0 . 0) (3 . 0) (4 . 0)) . ("sus"))
450 (((0 . 0) (2 . -1) (4 . -1)) . ("dim"))
451 ;Alternate: (((0 . 0) (2 . -1) (4 . -1)) . ("" (super "o")))
452 (((0 . 0) (2 . 0) (4 . 1)) . ("aug"))
453 ;Alternate: (((0 . 0) (2 . 0) (4 . 1)) . ("+"))
454 (((0 . 0) (1 . 0) (4 . 0)) . ("2"))
455 ;; Common seventh chords
456 (((0 . 0) (2 . -1) (4 . -1) (6 . -2)) . ("" (super "o") "7"))
457 (((0 . 0) (2 . 0) (4 . 0) (6 . 0)) . ("maj7"))
458 ;; urg! should use (0 . 0 2 . -1) -> "m", and add "7" to that!!
459 (((0 . 0) (2 . -1) (4 . 0) (6 . -1)) . ("m7"))
460 (((0 . 0) (2 . 0) (4 . 0) (6 . -1)) . ("7"))
461 (((0 . 0) (2 . -1) (4 . 0) (6 . 0)) . ("m(maj7)"))
462 ;jazz: the delta, see jazz-chords.ly
463 ;;(((0 . 0) (2 . -1) (4 . -1) (6 . -2)) . (super ((font-family . math) "N"))
464 ;; ugh, kludge slashed o
465 ;; (((0 . 0) (2 . -1) (4 . -1) (6 . -1)) . (rows ((raise . 1) "o") ((kern . -0.85) ((raise . 0.57) ((font-relative-size . -3) "/"))) "7")) ; slashed o
466 (((0 . 0) (2 . -1) (4 . -1) (6 . -1)) . (rows ((raise . 1) "o") (((kern . -0.85) (raise . 1.1) (font-relative-size . -2)) "/") "7")) ; slashed o
468 (((0 . 0) (2 . 0) (4 . 1) (6 . -1)) . ("aug7"))
469 (((0 . 0) (2 . 0) (4 . -1) (6 . 0)) . (rows "maj7" ((font-relative-size . -2) ((raise . 0.2) (music (named "accidentals--1")))) "5"))
470 (((0 . 0) (2 . 0) (4 . -1) (6 . -1)) . (rows "7" ((font-relative-size . -2) ((raise . 0.2) (music (named "accidentals--1")))) "5"))
471 (((0 . 0) (3 . 0) (4 . 0) (6 . -1)) . ("7sus4"))
472 ;; Common ninth chords
473 (((0 . 0) (2 . 0) (4 . 0) (5 . 0) (1 . 0)) . ("6/9")) ;; we don't want the '/no7'
474 (((0 . 0) (2 . 0) (4 . 0) (5 . 0)) . ("6"))
475 (((0 . 0) (2 . -1) (4 . 0) (5 . 0)) . ("m6"))
476 (((0 . 0) (2 . 0) (4 . 0) (1 . 0)) . ("add9"))
477 (((0 . 0) (2 . 0) (4 . 0) (6 . 0) (1 . 0)) . ("maj9"))
478 (((0 . 0) (2 . 0) (4 . 0) (6 . -1) (1 . 0)) . ("9"))
479 (((0 . 0) (2 . -1) (4 . 0) (6 . -1) (1 . 0)) . ("m9"))
482 chord::names-alist-american))
485 ;; American style chordnames use no "no",
486 ;; but otherwise very similar to banter for now
487 (define (chord::name-american tonic exception-part unmatched-steps
488 bass-and-inversion steps)
489 (let ((additions (chord::additions unmatched-steps))
491 (chord::inner-name-banter tonic exception-part additions subtractions
492 bass-and-inversion steps)))
502 ;; Jazz chords, by Atte Andr'e Jensen <atte@post.com>
503 ;; NBs: This uses the american list as a bass.
504 ;; Some defs take up more than one line,
505 ;; be carefull when messing with ;'s!!
510 ;; This is getting out-of hand? Only exceptional chord names that
511 ;; cannot be generated should be here.
512 ;; Maybe we should have inner-jazz-name and inner-american-name functions;
516 ;; DONT use non-ascii characters, even if ``it works'' in Windows
518 (define chord::names-alist-jazz '())
519 (set! chord::names-alist-jazz
523 ; major sixth chord = 6
524 (((0 . 0) (2 . 0) (4 . 0) (5 . 0)) . (((raise . 0.5) "6")))
525 ; major seventh chord = triangle
526 ;; shouldn't this be a filled black triange, like this: ? --jcn
527 ;; (((0 . 0) (2 . 0) (4 . 0) (6 . 0)) . (((raise . 0.5)((font-family . math) "N"))))
528 (((0 . 0) (2 . 0) (4 . 0) (6 . 0)) . (((raise . 0.5)((font-family . math) "M"))))
529 ; major chord add nine = add9
530 (((0 . 0) (2 . 0) (4 . 0) (1 . 0)) . (((raise . 0.5) "add9")))
531 ; major sixth chord with nine = 6/9
532 (((0 . 0) (2 . 0) (4 . 0) (5 . 0) (1 . 0)) . (((raise . 0.5) "6/9")))
535 ; minor sixth chord = m6
536 (((0 . 0) (2 . -1) (4 . 0) (5 . 0)) . (rows("m")((raise . 0.5) "6")))
537 ;; minor major seventh chord = m triangle
538 ;; shouldn't this be a filled black triange, like this: ? --jcn
539 ;;(((0 . 0) (2 . -1) (4 . 0) (6 . 0)) . (rows ("m") ((raise . 0.5)((font-family . math) "N"))))
540 (((0 . 0) (2 . -1) (4 . 0) (6 . 0)) . (rows ("m") ((raise . 0.5)((font-family . math) "M"))))
541 ; minor seventh chord = m7
542 (((0 . 0) (2 . -1) (4 . 0) (6 . -1)) . (rows("m")((raise . 0.5) "7")))
543 ; minor sixth nine chord = m6/9
544 (((0 . 0) (2 . -1) (4 . 0) (5 . 0) (1 . 0)) . (rows("m")((raise . 0.5) "6/9")))
545 ; minor with added nine chord = madd9
546 (((0 . 0) (2 . -1) (4 . 0) (1 . 0)) . (rows("m")((raise . 0.5) "add9")))
547 ; minor ninth chord = m9
548 (((0 . 0) (2 . -1) (4 . 0) (6 . -1) (1 . 0)) . (rows("m")((raise . 0.5) "9")))
551 ; dominant seventh = 7
552 (((0 . 0) (2 . 0) (4 . 0) (6 . -1)) . (((raise . 0.5) "7")))
553 ; augmented dominant = +7
554 ;(((0 . 0) (2 . 0) (4 . +1) (6 . -1)) . (((raise . 0.5) "+7"))) ; +7 with both raised
555 (((0 . 0) (2 . 0) (4 . +1) (6 . -1)) . (rows("+")((raise . 0.5) "7"))) ; +7 with 7 raised
556 ;(((0 . 0) (2 . 0) (4 . +1) (6 . -1)) . (rows((raise . 0.5) "7(")
557 ; ((raise . 0.3)(music (named ("accidentals-1"))))
558 ; ((raise . 0.5) "5)"))); 7(#5)
559 ; dominant flat 5 = 7(b5)
560 (((0 . 0) (2 . 0) (4 . -1) (6 . -1)) . (rows((raise . 0.5) "7(")
561 ((raise . 0.3)(music (named ("accidentals--1"))))
562 ((raise . 0.5) "5)")))
564 (((0 . 0) (2 . 0) (4 . 0) (6 . -1) (1 . 0)) . (((raise . 0.8)"7(9)")))
565 ; dominant flat 9 = 7(b9)
566 (((0 . 0) (2 . 0) (4 . 0) (6 . -1) (1 . -1)) . (
568 ((raise . 0.3)(music (named ("accidentals--1"))))
569 ((raise . 0.8)"9)")))
570 ; dominant sharp 9 = 7(#9)
571 (((0 . 0) (2 . 0) (4 . 0) (6 . -1) (1 . +1)) . (
573 ((raise . 0.3)(music (named ("accidentals-1"))))
574 ((raise . 0.8)"9)")))
575 ; dominant 13 = 7(13)
576 (((0 . 0) (2 . 0) (4 . 0) (6 . -1) (5 . 0)) . (((raise . 0.8)"7(13)")))
577 ; dominant flat 13 = 7(b13)
578 (((0 . 0) (2 . 0) (4 . 0) (6 . -1) (5 . -1)) . (
580 ((raise . 0.3)(music (named ("accidentals--1"))))
581 ((raise . 0.8)"13)")))
582 ; dominant 9, 13 = 7(9,13)
583 (((0 . 0) (2 . 0) (4 . 0) (6 . -1) (1 . 0) (5 . 0)) . (((raise . 0.8)"7(9, 13)")))
584 ; dominant flat 9, 13 = 7(b9,13)
585 (((0 . 0) (2 . 0) (4 . 0) (6 . -1) (1 . -1) (5 . 0)) . (
587 ((raise . 0.3)(music (named ("accidentals--1"))))
588 ((raise . 0.8)"9, 13)")))
589 ; dominant sharp 9, 13 = 7(#9,13)
590 (((0 . 0) (2 . 0) (4 . 0) (6 . -1) (1 . +1) (5 . 0)) . (
592 ((raise . 0.3)(music (named ("accidentals-1"))))
593 ((raise . 0.8)"9, 13)")))
594 ; dominant 9, flat 13 = 7(9,b13)
595 (((0 . 0) (2 . 0) (4 . 0) (6 . -1) (1 . 0) (5 . -1)) . (
596 ((raise . 0.8)"7(9, ")
597 ((raise . 0.3)(music (named ("accidentals--1"))))
598 ((raise . 0.8)"13)")))
599 ; dominant flat 9, flat 13 = 7(b9,b13)
600 (((0 . 0) (2 . 0) (4 . 0) (6 . -1) (1 . -1) (5 . -1)) . (
602 ((raise . 0.3)(music (named ("accidentals--1"))))
604 ((raise . 0.3)(music (named ("accidentals--1"))))
605 ((raise . 0.8)"13)")))
606 ; dominant sharp 9, flat 13 = 7(#9,b13)
607 (((0 . 0) (2 . 0) (4 . 0) (6 . -1) (1 . +1) (5 . -1)) . (
609 ((raise . 0.3)(music (named ("accidentals-1"))))
611 ((raise . 0.3)(music (named ("accidentals--1"))))
612 ((raise . 0.8)"13)")))
614 ;; diminished chord(s)
615 ; diminished seventh chord = o
618 ;; DONT use non-ascii characters, even if ``it works'' in Windows
620 ;;(((0 . 0) (2 . -1) (4 . -1) (6 . -2)) . ((raise . 0.8) (size . -2) ("o")))
621 (((0 . 0) (2 . -1) (4 . -1) (6 . -2)) . ("" (super "o")))
623 ;; half diminshed chords
624 ;; half diminished seventh chord = slashed o
625 ;; (((0 . 0) (2 . -1) (4 . -1) (6 . -1)) . (((raise . 0.8) "/o")))
626 (((0 . 0) (2 . -1) (4 . -1) (6 . -1)) . (rows ((raise . 1) "o") (((kern . -0.85) (raise . 1.1) (font-relative-size . -2)) "/") "7")) ; slashed o
628 ; half diminished seventh chord with major 9 = slashed o cancelation 9
629 (((0 . 0) (2 . -1) (4 . -1) (6 . -1) (1 . 0)) . (
631 ((raise . 0.3)(music (named ("accidentals-0"))))
632 ((raise . 0.8)"9)")));
634 ;; Missing jazz chord definitions go here (note new syntax: see american for hints)
637 chord::names-alist-american))
639 (define (step->text-alternate-jazz pitch)
641 (accidental->text (caddr pitch))
642 (list (number->string (+ (cadr pitch) (if (= (car pitch) 0) 1 8))))))
644 (define (step->text-jazz pitch)
645 (if (= (cadr pitch) 6)
647 ;; sharp 7 only included for completeness?
648 ((-2) (cons (accidental->text -1) '("7")))
651 ((1) (cons (accidental->text-super 1) '("7")))
652 ((2) (cons (accidental->text-super 2) '("7"))))
653 (step->text-alternate-jazz pitch)))
655 (define (chord::additions->text-jazz additions subtractions)
656 (if (pair? additions)
660 (cons 'super (step->text-jazz (car additions)))
661 (if (or (pair? (cdr additions))
662 (pair? subtractions))
664 (chord::additions->text-jazz (cdr additions) subtractions))
667 (define (chord::subtractions->text-jazz subtractions)
668 (if (pair? subtractions)
673 (cons 'super (step->text-jazz (car subtractions)))
674 (if (pair? (cdr subtractions))
676 (chord::subtractions->text-jazz (cdr subtractions)))
680 ;; TODO: maybe merge with inner-name-banter
681 ;; Combine tonic, exception-part of chord name,
682 ;; additions, subtractions and bass or inversion into chord name
683 (define (chord::inner-name-jazz tonic exception-part additions subtractions
684 bass-and-inversion steps)
692 (pitch->chord-name-text-banter tonic steps)
694 ;; why does list->string not work, format seems only hope...
695 (if (and (string-match "super" (format "~s" exception-part))
696 (or (pair? additions)
697 (pair? subtractions)))
699 (chord::additions->text-jazz additions subtractions)
700 (chord::subtractions->text-jazz subtractions)
701 (chord::bass-and-inversion->text-banter bass-and-inversion)))))
703 ;; Jazz style--basically similar to american with minor changes
704 (define (chord::name-jazz tonic exception-part unmatched-steps
705 bass-and-inversion steps)
706 (let ((additions (chord::additions unmatched-steps))
707 ;; get no 'omit' or 'no'
708 ;; (subtractions #f))
709 (subtractions (chord::subtractions unmatched-steps)))
710 (chord::inner-name-jazz tonic exception-part additions subtractions
711 bass-and-inversion steps)))
713 ;; wip (set! chord::names-alist-jazz
714 (define amy-chord::names-alist-jazz
717 (((0 . 0) (2 . -1)) . ("m"))
719 chord::names-alist-american))