Function
(ransegslen {keyword value}*)
Returns a list of len number of random segments from a specified distribution type. Segment values are either sample points or increments between points in the distribution. If points are returned they are sorted lowest to highest.
ransegs supports the following keyword arguments:
:type keyword:sum number:min number:max number:a number:b numberThe :sum argument cannot be specified if
either :min or :max appear as arguments to the function.
;; The ransegs function. (ransegs 5 :min 2 :max 4) ⇒ (2 2.2559445 3.4245749 3.7436724 4) (ransegs 5 :max 10 :type ':high-pass) ⇒ (0.0 7.4660807 8.559072 9.499652 10) (ransegs 5 :sum 10 :type ':high-pass) ⇒ (5.330133 0.32402468 1.5141625 1.9792953 0.85238457) (ransegs 5 :min -10 :max 10 :type ':mean) ⇒ (-10 -5.596928 1.3310728 7.758129 10) ;; High pass segments for increasing rain drops. (define (rainy-play len tot lb ub) (let ((segs (ransegs len :sum tot :type ':high-pass))) (process for i from 0 for s in segs unless (= i 0) output (new midi :time (now) :amplitude (interp i 0 .2 len .7) :duration (between .1 .25) :keynum (between lb ub)) wait s finally (output (new midi :time (now) :duration .35 :amplitude .8 :keynum (pick ub (- ub 5) lb)))))) (events (list (rainy-play 30 20 84 96) (rainy-play 30 20 72 84) (rainy-play 30 20 60 72) (rainy-play 30 20 48 60)) "test.mid") ⇒ "test.mid"