rsc3/doc/help/ugen/oscillators/tw-choose.help.scrbl

29 lines
844 B
Text
Raw Permalink Normal View History

2022-08-24 13:53:18 +00:00
#lang scribble/manual
@(require (for-label racket))
@title{(tw-choose trig array weights normalize)}
2022-08-28 10:27:01 +00:00
2022-08-24 13:53:18 +00:00
The output is selected randomly on recieving a trigger from an
array of inputs. The weights of this choice are determined from
the weights array. If normalize is set to 1 the weights are
continuously normalized, which means an extra calculation overhead.
When using fixed values the normalizeSum method can be used to
normalize the values. TWChoose is a composite of TWindex and
select
2022-08-28 10:27:01 +00:00
@racketblock[
2022-08-24 13:53:18 +00:00
(let ((a (mce3 (sin-osc ar 220 0)
(saw ar 440)
(pulse ar 110 0.1)))
(t (dust ar (mouse-x kr 1 1000 1 0.1)))
(w (mce3 0.6 0.15 0.05)))
(audition (out 0 (mul (tw-choose t a w 1) 0.1))))
2022-08-28 10:27:01 +00:00
]
2022-08-24 13:53:18 +00:00
Note: all the ugens are continously running. This may not be the
most efficient way if each input is cpu-expensive.
2022-08-28 10:27:01 +00:00