rsc3/doc/help/ugen/demand/dswitch.help.scrbl

45 lines
1 KiB
Text
Raw Permalink Normal View History

2022-08-24 13:53:18 +00:00
#lang scribble/manual
@(require (for-label racket))
@title{(dswitch index array)}
2022-08-28 10:27:01 +00:00
2022-08-24 13:53:18 +00:00
demand rate generator for switching between inputs
index - which of the inputs to return
array - array of values or other ugens
In difference to dswitch1, dswitch embeds all items
of an input demand ugen first before looking up the
next index.
2022-08-28 10:27:01 +00:00
@racketblock[
2022-08-24 13:53:18 +00:00
(let* ((a0 (dwhite 2 3 4))
(a1 (dwhite 2 0 1))
(a2 (dseq 2 (make-mce (list 1 1 1 0))))
(i (dseq 2 (make-mce (list 0 1 2 1 0))))
(d (dswitch i (make-mce (list a0 a1 a2))))
(t (impulse kr 4 0))
(f (mul-add (demand t 0 d) 300 400))
(o (mul (sin-osc ar f 0) 0.1)))
(audition (out 0 o)))
2022-08-28 10:27:01 +00:00
]
2022-08-24 13:53:18 +00:00
compare with dswitch1
2022-08-28 10:27:01 +00:00
@racketblock[
2022-08-24 13:53:18 +00:00
(let* ((a0 (dwhite 2 3 4))
(a1 (dwhite 2 0 1))
(a2 (dseq 2 (make-mce (list 1 1 1 0))))
(i (dseq 2 (make-mce (list 0 1 2 1 0))))
(d (dswitch1 i (make-mce (list a0 a1 a2))))
(t (impulse kr 4 0))
(f (mul-add (demand t 0 d) 300 400))
(o (mul (sin-osc ar f 0) 0.1)))
(audition (out 0 o)))
2022-08-28 10:27:01 +00:00
]
2022-08-24 13:53:18 +00:00