pc:make-chord-fixed   scheme


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/libs/core/pc_ivl.xtm

Implementation

;; make a chord that is fixed at either the 'top or the 'bottom
;; where fixed is as close as the chord allows to fix-point
;; defaults to bottom
;;
;; (pc:make-chord-fixed 60 3 '(0 3 7))      => (60 63 67)
;; (pc:make-chord-fixed 60 3 '(0 3 7) 'top) => (51 55 60)
;;
(define pc:make-chord-fixed
   (lambda (fix-point number pc . args)
      (if (< number 1)
          '()
          (let loop ((pitches (list (real->integer (pc:quantize fix-point pc))))
                     (num (- number 1))
                     (dir (if (null? args) + (if (equal? 'bottom (car args)) + -))))
            (if (> num 0)
                (loop (cons (real->integer (pc:relative (car pitches) (dir 1) pc))
                            pitches)
                      (- num 1)
                      dir)
                (reverse pitches))))))


Back to Index