pc:distance   scheme


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

Implementation

;; distance between pitch and a pc
(define pc:distance
  (lambda (pitch pc)
    (if (atom? pc) (set! pc (list pc)))
    (let ((p (modulo pitch 12)))
      (car (cl:sort (map (lambda (class)
                           (let ((val (abs (- p class))))
                             (abs (if (< val (- 12 val)) val (- 12 val)))))
                         pc) <)))))


Back to Index

Similar Entries