;;; 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)
Somewhat stupid question but I do not find a function that would allow me to reorder a sequence of pitches.
Let me explain, on a forum where Messiaen's limited transposition modes are discussed, I wanted to show that with Opumodus we could very easily analyze the modes and recreate them. I have no problem with those who are in total symmetry and divisible by two, but if I take the mode 3: (c4 d4 eb4 e4 gb4 g4 ab4 bb4 b4), using the function pitch-transpose-start I get in the end the mode but according to the postponement of the intervallic structure on c4 d4 ab4 is => ((c4 e4 gs4) (d4 fs4 bb4) (eb4 g4 b4)). I tried to reorder with the function pcs-normal-order the mode is reordered but with however the c4 in last position: (d4 eb4 e4 fs4 g4 gs4 bb4 b4 c4). Now, I suppose there is a function that makes it possible to obtain the right disposition. What is it ?
(setf modmessiaen3 '(c4 d4 eb4 e4 gb4 g4 ab4 bb4 b4)) (setf SIMessiaenMod3 (pitch-to-interval modmessiaen3)) ; => (2 1 1 2 1 1 2 1) (setf mod3divide (gen-divide 3 modmessiaen3)) (setf firstmodmessiaen3 (filter-first 3 modmessiaen3)) (setf report3 '(c4 e4 ab4)) (setf rep3 (gen-repeat 3 (list report3))) (setf pch3 (modus (flatten (pitch-transpose-start firstmodmessiaen3 rep3)))) (setf MessiaenMod3 (pcs-normal-order pch3 :pitch)) (setf SIMessiaenMod3a (pitch-to-interval MessiaenMod3)) ; => (1 1 2 1 1 2 1 -11) (setf mod3chordsM (melodize '((c4eb4gb4) (d4gb4bb4) (eb4gb4bb4) (e4g4b4) (gb4bb4db5) (g4b4d5) (ab4b4d5) (bb4gb5) (b4d5gb5)))) (setf analysechords3 (pcs-analysis (integer-to-pitch (modus mod3chordsM))))
In particular, this distorts the analysis of the interstellar structure of mode 3:
of (2 1 1 2 1 1 2 1) I get (1 1 2 1 1 2 1 -11)
Besides, there is probably a more efficient script than the one I tried?
PS : In fact, I realize that the function pcs-normal-order is not adapted at all according to the modes.