Jump to content

Featured Replies

Posted

reset a pitch-sequence on a specific pitch (lowest, highest, middle pitch of the sequence)

 

;;;; SUB


(defun center-position-in-list (list &key (get-value 'nil))
  (let ((pos))
    (progn
      (setf pos (if (evenp (length list))
                  (/ (length list) 2)
                  (/ (1+ (length list)) 2)))
      (if (equal get-value 'nil)
        (append pos)
        (nth (1- pos) list)))))


;;; MAIN

(defun reset-pitch-sequence (pitch-sequence pitch &key (type 'low))
  (let ((pitch1 (cond  ((equal type 'low)
                        (car (find-ambitus pitch-sequence :type :pitch)))
                       ((equal type 'high)
                        (cadr (find-ambitus pitch-sequence :type :pitch)))
                       ((equal type 'center) 
                        (center-position-in-list pitch-sequence :get-value t)))))
    (pitch-transpose (car (pitch-to-interval (list (if (chordp pitch1)
                                                     (car (pitch-melodize pitch1))
                                                     (append pitch1))
                                                   pitch))) pitch-sequence)))



(reset-pitch-sequence '(gs2 g2 a2 fs2 ds2 f2 e2) 'fs3 :type 'low)
=> (b3 bb3 c4 a3 fs3 gs3 g3)

(reset-pitch-sequence '(gs2 g2 a2 fs2 ds2 f2 e2) 'fs3 :type 'high)
=> (f3 e3 fs3 eb3 c3 d3 cs3)

(reset-pitch-sequence '(gs2 g2 a2 fs2 ds2 f2 e2) 'fs3 :type 'center)
=> (f3 e3 fs3 eb3 c3 d3 cs3)

 

 

Create an account or sign in to comment


Copyright © 2014-2025 Opusmodus™ Ltd. All rights reserved.
Product features, specifications, system requirements and availability are subject to change without notice.
Opusmodus, the Opusmodus logo, and other Opusmodus trademarks are either registered trademarks or trademarks of Opusmodus Ltd.
All other trademarks contained herein are the property of their respective owners.

Powered by Invision Community

Important Information

Terms of Use Privacy Policy