;; 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) <)))))