Search the Community
Showing results for tags 'quantize'.
;;; 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)
Does Opusmodus perhaps already have some quantisation function that expects a list of floats and that basically rounds these floats into a metric rhythm, including using tuplets? I am aware of vector-to-length – that implements a simple form of what I am looking for, but it does not support tuplets. Other algorithmic composition systems have more sophisticated quantisation facilities. For example, OpenMusic provides the box omquantify (among other functions in the Kant library). http://support.ircam.fr/docs/om/om6-manual/co/Quantification.html I am aware that quantification is a complex process, but perhaps that is already there in Opusmodus. Best, Torsten