pc:move-chord   scheme


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

Implementation

;; find shortest part movement from chord to pc
(define pc:move-chord
   (lambda (chord pc)
      (let loop ((pci pc)
                 (chda chord)
                 (chdb '()))
         (if (null? pci) (set! pci pc))
         (if (null? chda)
             (cl:sort chdb <)
             (let* ((match (pc:find-closest chda pci))
                    (new-pitch (if (> (random) .5)
                                   (pc:quantize-low match pci)
                                   (pc:quantize match pci))))
                (loop (remove-first (modulo new-pitch 12) pci)
                      (remove-first match chda)
                      (cons new-pitch chdb)))))))


Back to Index