Jump to content
Sign in to follow this  
AM

add-rnd-dust to lengths

Recommended Posts

Posted (edited)
;;; ADD-RND-DUST TO LENGTHS
;;; this function adding RANDOMLY some "dust" to the LENGTHS, so it will be like a little rubato,
;;; or "humanizing"-effect. the ADD-SPAN is in percent (0.1 = 10%) on each length-value. 

(defun add-rnd-dust (omnseq &key (span '(0.1)) (seed nil) (quantize '(1 2 3 4 5 6 7 8 9)))
  (let ((rhy (omn :length omnseq))
        (sp))
    (progn 
      (setf rhy (loop 
                  with cnt = 0
                  for i in rhy

                  do (setf sp (nth cnt span))

                  when (not (null seed))
                  do (incf seed)
                  
                  when (> i 0) 
                  collect   (+ i (car (rnd-number 1 0.0 (* i sp) :seed seed)))
                  else collect (- i (car (rnd-number 1 0.0 (* i sp) :seed seed)))
                  
                  when (< cnt (1- (length span)))
                  do (incf cnt)))

      (make-omn :length (quantize (float-to-ratio  rhy :ratio 1/1) quantize)
                :pitch (omn :pitch omnseq)
                :velocity (omn :velocity omnseq)
                :articulation (omn :articulation omnseq)))))



;;; EXAMPLE

(add-rnd-dust '(h c3 h. d3 -h q. f3 q g3) 
              :span '(0.5 0.3 0.2 0.1) 
              :quantize '(1 2 3 4 8) 
              :seed 123)

=> (ht c3 h.s. d3 -e -q -t e.._3h f3 3q_q g3)
    
(add-rnd-dust '(q c3 q d3 q e3 q f3 q g3) 
              ;;possible add-span per value (1 = 100% of the value, 0.5 = 50% etc.) 
              ;;if it's a list, it will stay on the last value of the span-list
              :span '(0.4 0.3 0 0 2) 
              ;;how to quantize new lengths
              :quantize '(1 2 4 8) 
              :seed 123)

=> (q c3 qt d3 q e3 f3 hs. g3)


(add-rnd-dust '(h c3 h. d3 h e3 q. f3 q g3) 
              :span '(0.5) ;; = every value max-add 50%
              :quantize '(1 2 3 4 8) 
              :seed 2999)

=> (hs. c3 wt d3 3w.e e3 3wq. f3 q g3)


(add-rnd-dust '(q c3 q d3 q e3 q f3 q g3) 
              :span '(0.4 0.3 0 0 2) 
              :quantize '(1 2 4 8) 
              :seed 1111)

=> (qt c3 qs d3 q e3 f3 q... g3)


(add-rnd-dust '(h c3 h d3 h e3 h f3 h g3) 
              :span '(0.3 0.2 0.1 0 0.2) 
              :quantize '(1 2 4 3 5) 
              :seed 2999)

=> (5dh. c3 5dhq. d3 h e3 f3 he g3)

 

Edited by AM
bug by omn-replace (wrong rests), new solution with make-omn, works now

Share this post


Link to post
Share on other sites

@janusz: if you try the function a few times (without seed) , you will see (by cmd1), that sometimes the last TIE isn't there. i think QUANTIZE is doing this little bug... (but perhaps only a xml-display-thing?)

 

Bildschirmfoto 2019-04-25 um 22.41.43.png

 

 

Share this post


Link to post
Share on other sites

an example: 

 

this is the BASIC-version (without "dust"):

all mapped in 1/32 - retrograde sorting processes (with GEN-SORT):

pitch-process from chromatic to 12tone-row (by sort) and from sorted length-values (all 1/32,

then all 1/16 etc... to more complex/mixed pattern (by sort))

 

Bildschirmfoto 2019-04-26 um 10.49.17.png

 

 

with this setup:

 

Bildschirmfoto 2019-04-26 um 10.49.48.png

 

 

the result with some "dust":

if you you have a look to the span-list above (compare with the new score) you will see:

no change at the beginning, then more and more randomized (or made flexible).

 

Bildschirmfoto 2019-04-26 um 10.48.35.png

 

Share this post


Link to post
Share on other sites
18 hours ago, AM said:

@janusz: if you try the function a few times (without seed) , you will see (by cmd1), that sometimes the last TIE isn't there. i think QUANTIZE is doing this little bug... (but perhaps only a xml-display-thing?)

 

Maybe tolerance in quantize function will fix the problem:

(defun add-rnd-dust (omnseq &key (span '(0.1)) (seed nil) (quantize '(1 2 3 4 5 6 7 8 9)) (tolerance 0.05))
...)
(add-rnd-dust '(h c3 h. d3 -h q. f3 q g3) 
              :span '(0.5 0.3 0.2 0.1) 
              :quantize '(1 2 3 4 8) 
              :seed nil
              :tolerance 0.03)

 

No quantiser can take care of all the small nuances 🙂 this is why we have the tolerance option in the function.

 

I like the function.

Share this post


Link to post
Share on other sites

i already did that 🙂

(defun add-rnd-dust (omnseq &key (span '(0.1)) (seed nil) (quantize '(1 2 3 4 5 6 7 8 9)) (scale 1.0) (tolerance 0.05))
  (let ((rhy (omn :length omnseq))
        (sp))
    (progn 
      (setf rhy (loop 
                  with cnt = 0
                  for i in rhy

                  do (setf sp (nth cnt span))

                  when (not (null seed))
                  do (incf seed)
                  
                  when (> i 0) 
                  collect   (+ i (car (rnd-number 1 0.0 (* i sp) :seed seed)))
                  else collect (- i (car (rnd-number 1 0.0 (* i sp) :seed seed)))
                  
                  when (< cnt (1- (length span)))
                  do (incf cnt)))

      (make-omn :length (quantize (float-to-ratio  rhy :ratio 1/1) quantize :scale scale :tolerance tolerance)
                :pitch (omn :pitch omnseq)
                :velocity (omn :velocity omnseq)
                :articulation (omn :articulation omnseq)))))

 

Share this post


Link to post
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.

Sign in to follow this  

  • Similar Topics

    • By Andy
      I am finding that if I have a score with two notes repeated the second note does not play when sending to my DAW. I am pretty sure this is because the notes are literally the length of the notation i.e a crotchet is exactly 480 ticks (or whatever it is in ticks) which causes the second note, not being a different pitch, to not play. Is there a way round this?
    • By AM
      works, but only for one-time-repetiton... could you use it?
       
      (defun merge-lengths-of-a-pitch-rep (omn-seq) (let* ((omn-seq (single-events omn-seq)) (l)) (flatten (loop repeat (length omn-seq) for cnt = 0 then (incf cnt) when (equal (omn :pitch (nth cnt omn-seq)) (omn :pitch (nth (1+ cnt) omn-seq))) do (progn (setf l (length-note-merge (append (omn :length (nth cnt omn-seq)) (omn :length (nth (1+ cnt) omn-seq))))) (incf cnt)) and collect (omn-replace :length l (nth cnt omn-seq)) else collect (nth cnt omn-seq))))) (merge-lengths-of-a-pitch-rep '(e c4 mf d4 d4 e4 f4 f4)) => (e c4 mf q d4 mf e e4 mf q f4 mf)  
    • By AM
      (defun replace-lengths-of-a-pitch-sequence (omn-list pitch-list length-list) (flatten (loop with cnt = 0 for i in (single-events omn-list) when (equal (cadr i) (nth cnt pitch-list)) collect (append (list (nth cnt length-list)) (rest i)) and do (incf cnt) else collect i when (= cnt (length pitch-list)) do (setf cnt 0)))) (setf white-series-l (vector-to-pitch '(c4 c5) (gen-white-noise 100 :type :logistic :seed 23))) (replace-lengths-of-a-pitch-sequence (cons 't white-series-l) '(e4 f4 a4 gs4 g4 b4 c5 bb4) '(2/16 3/16 4/16 5/16 6/16 7/16 8/16)) => '(t gs4 mf t g4 mf t g4 mf t c5 mf t g4 mf t gs4 mf 1/8 e4 mf 3/16 f4 mf t gs4 mf t gs4 mf t bb4 mf t gs4 mf t fs4 mf t fs4 mf t f4 mf t g4 mf t bb4 mf t b4 mf t b4 mf t g4 mf t e4 mf t g4 mf t fs4 mf t b4 mf 1/4 a4 mf t g4 mf t g4 mf t a4 mf t b4 mf t fs4 mf t bb4 mf t a4 mf 5/16 gs4 mf t a4 mf 3/8 g4 mf t a4 mf t a4 mf t a4 mf t a4 mf t a4 mf t f4 mf t bb4 mf t g4 mf t fs4 mf 7/16 b4 mf t a4 mf t g4 mf t bb4 mf t a4 mf t gs4 mf t a4 mf t gs4 mf t g4 mf t g4 mf t gs4 mf t a4 mf t f4 mf t f4 mf t bb4 mf t gs4 mf t fs4 mf t a4 mf t g4 mf t a4 mf t g4 mf t gs4 mf t bb4 mf t eb4 mf t bb4 mf t fs4 mf t fs4 mf t gs4 mf t g4 mf t gs4 mf t gs4 mf t c4 mf t gs4 mf t g4 mf t gs4 mf 1/2 c5 mf bb4 mf t gs4 mf t fs4 mf t fs4 mf t bb4 mf t a4 mf t g4 mf t g4 mf t b4 mf t g4 mf t f4 mf t g4 mf t gs4 mf t gs4 mf t gs4 mf t gs4 mf t fs4 mf t gs4 mf t eb4 mf t a4 mf)  
×
×
  • Create New...