pc:closest-pc   scheme


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

Implementation

;; find the pc that is closest to given pitch
;; useful for finding next step for pitch given a chord
(define pc:closest-pc
  (lambda (pitch pc)
    (cdar (cl:sort (map (lambda (class) (cons (pc:distance pitch class) class)) pc)
                   (lambda (a b) (< (car a) (car b)))))))


Back to Index