Stephane Boussuge Posted November 6, 2021 Share Posted November 6, 2021 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) |# opmo, AM, JulioHerrlein and 1 other 4 Quote Link to comment Share on other sites More sharing options...
AM Posted February 3, 2022 Share Posted February 3, 2022 great function, stephane!! little extension/different mapping ;;; a slightly extended version of stephane's FUNCTION ;;; with integer-output so you could map it on pitchfields/chords (defun pitch-trajectory* (nbpitch range tendency &key (variance 0.5) (type :around) (quantize 1/2) (smooth 1) filter-repeat seed (output 'int) (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)))) ;;; pitch-ouput like in stephane's version (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 '(fs3 g5) '(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 (loop repeat 20 collect (rnd-sample-seq (rnd-pick '(11 17 29)) seq)) :length (pick-norepeat 20 '(t t. s -t. -t)) :span :pitch)) Stephane Boussuge 1 Quote Link to comment Share on other sites More sharing options...
opmo Posted February 3, 2022 Share Posted February 3, 2022 pick-norepeat is missing. Quote Link to comment Share on other sites More sharing options...
Stephane Boussuge Posted February 4, 2022 Author Share Posted February 4, 2022 It is also possible to map on pitch fields that way: ;;; Mapping on pitch-field (pitch-list-plot (tonality-map (append (chordize (make-scale 'c2 24 :alt '(2 1 6 5 4))) '(:map 'step )) (pitch-trajectory 128 '(0 23) '(0.1 1 0.1) :filter-repeat 1 :variance 0.8 ))) You can use different fields that way: (setf pfields (list (chordize (make-scale 'c2 24 :alt '(2 1 6 5 4))) (chordize (make-scale 'c2 24 :alt '(3 1 2 4))) (chordize (make-scale 'c2 24 :alt '(2 2 2 1))) )) (setf path (tonality-series pfields :map '(step))) (pitch-list-plot (tonality-map path (gen-eval 3 '(pitch-trajectory 128 '(0 23) '(0.1 1 0.1) :filter-repeat 1 :variance 0.2 )) )) And also use the :time parameter from tonality-map system if you use OMN expression: ;;; Example with omn without :time parameter (pitch-list-plot (tonality-map path (gen-filter-euclidean 12 16 11 16 (pitch-trajectory 128 '(0 23) '(0.1 1 0.1) :filter-repeat 1 :variance 0.2 ) 's) )) ;;; Same with :time parameter (pitch-list-plot (tonality-map path (gen-filter-euclidean 12 16 11 16 (pitch-trajectory 128 '(0 23) '(0.1 1 0.1) :filter-repeat 1 :variance 0.2 ) 's) :time '(h w))) S. JulioHerrlein and AM 2 Quote Link to comment Share on other sites More sharing options...
AM Posted February 4, 2022 Share Posted February 4, 2022 thanx, stephane! you are my OPMO-function-MASTER! Stephane Boussuge and JulioHerrlein 1 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.