- [Function]
(
pick
arg ...)
Returns a randomly selected argument to the function.
Examples:
Example 1. The pick
function.
(pick 1 2 3 4 5) ⇒ 3 (pick 1 2 3 4 5) ⇒ 2 (pick 1 1 1 0 2) ; poor man's weighted selection ⇒ 1
Example 2. Random selection using pick
.
(define (play-pick len) (process repeat len for o = (pick 0 0 -24 24) for r = (pick .1 .2 .2 .2 .4) for k = (between 60 67) for a = (pick .25 .25 .24 .5 .5 .75) output (new midi :time (now) :duration (* r (pick 1.5 .5)) :keynum (+ k o) :amplitude a) wait r)) (events (play-pick 60) "test.mid") ⇒ "test.mid"