123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- (def. (pitch-integer.pitchclass-integer [pitch-integer? i])
- (modulo i 12))
- '(TEST
- > (X 1 9)
- ;; not 8
- )
- (def r0 (.map '(3 1 9 5 4 6 8 7 12 10 11 2) dec-function))
- (def ri0 (.map '(3 5 9 1 2 12 10 11 6 8 7 4) dec-function))
- (def (r0->ri [twelve-tone-row? r])
- ;;;XX
- ri0)
- (TEST
- > (equal? (r0->ri r0) ri0)
- #t)
- (def (random-twelve-tone-row) -> twelve-tone-row?
- (=> (iota 12 2)
- (.map (lambda (v) (cons (random-float) v)))
- (sort (on car <))
- (.map cdr)))
- (def (twelve-tone-row->intervals [twelve-tone-row? v])
- (chord->intervals v))
- (def (chord.+pitchclass c i)
- (.map c (lambda (v) (pitch-integer.pitchclass-integer (+ v i)))))
- (def (generate-matrix.1 [twelve-tone-row? r0])
- (let (ri (r0->ri r0))
- ;; ri = pitches
- (.map r0
- (lambda (v)
- (chord.+pitchclass ri (- v (first r0)))))))
- (def (generate-matrix [twelve-tone-row? r0])
- (let (ri (r0->ri r0))
- ;; ri = pitches
- (.map ri
- (lambda (v)
- (chord.+pitchclass r0 (- v (first ri)))))))
- (def. (list.inc v) (.map v inc-function))
- (TEST
- > (equal? ((flip cons) 'a '())
- (cons '() 'a))
- #t)
- (def. (lists.inc v) (.map v .inc))
- (TEST
- > (=> (generate-matrix r0)
- .inc)
- ((3 1 9 5 4 6 8 7 12 10 11 2)
- (5 3 11 7 6 8 10 9 2 12 1 4)
- (9 7 3 11 10 12 2 1 6 4 5 8)
- (1 11 7 3 2 4 6 5 10 8 9 12)
- (2 12 8 4 3 5 7 6 11 9 10 1)
- (12 10 6 2 1 3 5 4 9 7 8 11)
- (10 8 4 12 11 1 3 2 7 5 6 9)
- (11 9 5 1 12 2 4 3 8 6 7 10)
- (6 4 12 8 7 9 11 10 3 1 2 5)
- (8 6 2 10 9 11 1 12 5 3 4 7)
- (7 5 1 9 8 10 12 11 4 2 3 6)
- (4 2 10 6 5 7 9 8 1 11 12 3)))
- '(def (transpose ))
|