Class
copierA specialized pattern that copies and repeats periods of a subpattern.
copier supports the following slot initializations:
:of pattern:for {number | pattern}:repeat-for {number | pattern}:for initialization to be ignored.
;; The copier pattern. (define x (new copier :of (new cycle :of '(a b c) :for 2) :for 3)) (loop repeat 3 collect (next x #t)) ⇒ ((a b a b a b) (c a c a c a) (b c b c b c)) (define x (new copier :of (new cycle :of '(a b c) :for 2) :repeat-for 3)) (loop repeat 9 collect (next x #t)) ⇒ ((a b) (a b) (a b) (c a) (c a) (c a) (b c) (b c) (b c)) ;; Repetition and randomness. (define (wander num tmpo) ;; play segments of 5 notes chosen randomly between keynums ;; 41 and 60 with no direct repetition within each segment. ;; play segments 1, 3 or 5 times before selecting the next. (let* ((segs (new weighting :of (loop for i from 41 to 60 collect (list i :max 1)) :for 5)) (bass (new copier :of segs :for (new weighting :of '(1 3 5)) :repeat num)) (amps (new heap :of '(.6 .4 .4 .4 .4)))) (process for k = (next bass) for a = (next amps) until (eod? k) output (new midi :time (now) :keynum k :duration (if (> a .5) 5 3) :amplitude a) wait (rhythm 1/20 tmpo)))) (events (wander 20 48) "test.mid") ⇒ "test.mid"
copy-object [Function]