Jump to content

Function for direction/trajectory?


Recommended Posts

What function would I use if I have a list of ascending pitches and I want to generate a sequence that would gradually work its way up from lowest to highest pitch ( or vice versa), with some control over volatility and how quickly the seq goes from low to highest?   So far I've found the brownian motion sample function with a "drift" arg for doing something like this.  Are there other functions for doing this kind of thing? 

 

What I have in mind is something like the first 13 bars of Varese's Density 21.5, where there's a gradual upward trajectory in pitch, culminating in bar 13. 

 

https://petruccilibrary.ca/files/imglnks/caimg/c/c0/IMSLP405195-PMLP656047-Varèse_-_Density_21.5_(flute).pdf

 

 

Link to comment
Share on other sites

a quick idea: if you would do it with rnd-walk and use it as positions  in a pitchfield, you have a some global control over all parameters.

pitchfields are - in my opinion - useful, because you have some nice vertical control. you don't have this if you simply have the random walk out of the pitches directly.

 

(progn
  ;; do a rnd-walk with tendency
  (setf walk (gen-walk 24 :step '(1 2 3) :backward 0.3 :forward 0.7))

  ;; transform it to positions in a pitchfield and "reset list" if min-val < 0
  (setf positions (cumulative-sums walk))
  (setf positions (if (< (find-min positions) 0)
                       (x+b positions (abs (find-min positions)))
                      positions))

  ;; define a pitchfield (or chord)
  (setf pitchfield (append (expand-tonality '(b3 messiaen-mode6))
                           (expand-tonality '(b4 messiaen-mode5))
                           (expand-tonality '(b5 messiaen-mode4))
                           (expand-tonality '(b6 messiaen-mode3))))
  
  ;; reading pitchfield by positions
  (position-filter (cumulative-sums walk) pitchfield))

 

Link to comment
Share on other sites

Here's  function I've made few years ago, hope it help:

 

;;;===================================
;;; 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
                                 (output 'pitch)
                                 (int-range '(0 24))
                                 )
  (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 (cond ((equal output 'pitch)
                     (vector-to-pitch range smoothedval :quantize quantize))
                    ((equal output 'int)
                     (vector-round (car int-range) (cadr int-range) smoothedval)))))
         
    (if filter-repeat 
      (filter-repeat filter-repeat out)
      out))))


#|
;;; Test du bon fonctionnement du seed
(progn
(init-seed 1)
(rnd-sample 4 '(c4 d4 e4 f4))
(rnd-sample 4 '(c4 d4 e4 f4))
(pitch-trajectory 32 '(c4 g5) '(0.1 1 0.1))
(init-seed nil)
)

;;; 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)

;;; pitch-ouput 

(pitch-list-plot
 (pitch-trajectory 128 '(fs3 g5) '(0.1 1 0.1) 
                   :filter-repeat 1
                   :variance 0.8
                   :output 'pitch
                   ))

;;; integer-output for MAPPING

(list-plot
 (pitch-trajectory 128 '(fs3 g5) '(0.1 1 0.1) 
                   :filter-repeat 1
                   :variance 0.8
                   :output 'int
                   :int-range '(0 23)
                   ))



;;; MAPPING the integers on a scale or pitchfield

(loop 
  for i in (pitch-trajectory 128 '(fs3 g5) '(0.1 1 0.1) 
                   :filter-repeat 1
                   :variance 0.8
                   :output 'int
                   :int-range '(0 23))
  with scale = (make-scale 'c2 24 :alt '(1 2))
  collect (nth i scale))


(loop 
  for i in (pitch-trajectory 128 '(fs3 g5) '(0.1 3 0.1) 
                   :filter-repeat 1
                   :variance 0.9
                   :output 'int
                   :int-range '(0 23))
  with scale = (make-scale 'c2 24 :alt '(2 1 6 5 4))
  collect (nth i scale))


;;; an example with MAPPING and SAMPLING

(progn
  (setf seq (loop 
              for i in (pitch-trajectory 64 '(fs2 g6) '(0.1 3 0.1) 
                                          :filter-repeat 1
                                          :variance 0.4
                                          :output 'int
                                          :int-range '(0 23))
            with scale = (make-scale 'c2 24 :alt '(2 1 6 5 4))
              collect (nth i scale)))
  
  (make-omn :pitch (flatten (loop repeat 20 collect (rnd-sample-seq (rnd-pick '(11 17 29)) seq)))
            :length (rnd-sample 20 '((s s s s)(t t t t t t t t)(e e)))
            ))
|#


It comes from this interesting discussion with Andre:

 

Link to comment
Share on other sites

Thank you all, will have a look.  Am hoping a function like this could be included/simplified as an OM system function, since the idea of a direction/trajectory seems basic and something others would want too.  

Link to comment
Share on other sites

4 hours ago, eboats said:

Thank you all, will have a look.  Am hoping a function like this could be included/simplified as an OM system function, since the idea of a direction/trajectory seems basic and something others would want too.  

Iti is very easy with OM to do pitch trajectories by generating some vectors and use vector-map to map then on anything. A good suggestion for controlled vector generation could be gen-tendency function.

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