Jump to content

Expand pitches within range


Recommended Posts


(gen-sieve '(c0 c9) (pitch-to-interval '(c4 e4 g4 bb4 c5)) :type :pitch)
(gen-sieve (midi-to-pitch '(12 127)) (pitch-to-interval '(c4 e4 g4 bb4 c5)) :type :pitch)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; putted in a little function ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun gen-sequence  (pitch-sequence midi-ambitus)
  (gen-sieve (midi-to-pitch midi-ambitus) (pitch-to-interval pitch-sequence) :type :pitch))

;; eval
(gen-sequence '(c4 e4 g4 bb4 c5) '(12 127))
;; => (c0 e0 g0 bb0 c1 e1 g1 bb1 c2 e2 g2 bb2 c3 e3 g3 bb3 c4 e4 g4 bb4 c5 e5 g5 bb5 c6 e6 g6 bb6 c7 e7 g7 bb7 c8 e8 g8 bb8 c9 e9 g9)

 

Link to comment
Share on other sites

version in (almost) pure lisp (only "midi-to-pitch" is OM)

 

(defun gen-sieve-userdefined (ambitus.midi intervals)
  (midi-to-pitch 
   (loop
     with interval.cnt = -1
     for pitch = (first ambitus.midi) then (setq pitch (+ (nth interval.cnt intervals) pitch))
     when (<= pitch (second ambitus.midi))
     collect pitch into bag
     else return bag
     
     do (incf interval.cnt)
     when (= interval.cnt (length intervals))
     do (setq interval.cnt 0))))

(gen-sieve-userdefined '(12 72) '(4 2 3))

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

Terms of Use Privacy Policy