Jump to content

pitch-trajectory


Recommended Posts

Hi,

 

here's a function I've made for my personal usage.

May be it could be useful for some users...

Best

 

Stéphane

 

;;;===================================
;;; PITCH-TRAJECTORY
;;;===================================
;;; SB 1.11.21
;;;===================================
(defun pitch-trajectory (nbpitch range tendency 
                                 &key 
                                 (variance 0.5) 
                                 (type :around) 
                                 (quantize 1/2) 
                                 (smooth 1)
                                 filter-repeat
                                 seed
                                 )
  (setf seed (rnd-seed seed))
  (do-verbose ("pitch-trajectory :seed ~s" seed)
  (let* ((values (gen-tendency nbpitch tendency :variance variance :type type 
                           :seed (seed)))
         (smoothedval (vector-smooth smooth values))
         (out (vector-to-pitch range smoothedval :quantize quantize))
         )
    (if filter-repeat 
      (filter-repeat filter-repeat out)
      out))))


#|
;;; Tests divers
(pitch-trajectory 32 '(c4 g5) '(0.1 1 0.1) :seed 1234)
(pitch-trajectory 32 '(c4 g5) '(0.1 1 0.1) :seed 1234 :filter-repeat 1)
(pitch-trajectory 32 '(c4 g5) '(0.1 1 0.1) :seed 1234 
                  :filter-repeat 1
                  :variance 1
                  )
(pitch-trajectory 32 '(c4 g5) '(0.1 1 0.1) :seed 1234 
                  :filter-repeat 1
                  :variance 0.1
                  )
(pitch-trajectory 32 '(c4 g5) '(0.1 1 0.1) :seed 1234 
                  :filter-repeat 1
                  :smooth 0.1
                  )
(pitch-trajectory 32 '(c4 g5) '(0.1 1 0.1) :seed 1234 
                  :filter-repeat 1
                  :quantize 1/4
                  )
(pitch-trajectory 32 '(c4 g5) '(0.1 1 0.1) :seed 1234 
                  :filter-repeat 1
                  :quantize 1/8
                  )
(pitch-trajectory 32 '(c4 g5) '(0.1 1 0.1) :seed 1234 
                  :filter-repeat 1
                  :variance 1
                  :quantize 1/8
                  )



(gen-filter-change 
 (pitch-trajectory 
  32 '(c4 g5) '(0.1 1 0.1) :seed 1234)
 's)


|#

 

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