2 summary:: Demand rate envelope generator
3 related:: Classes/Demand, Classes/Duty, Classes/TDuty
4 categories:: UGens>Demand, UGens>Envelopes
7 Plays back break point envelope contours (levels, times, shapes) given by demand ugens. The next values are called when the next node is reached.
16 A demand UGen or any other UGen returning level values. If this ends, the
18 code::doneAction:: is evaluated.
23 A demand UGen or any other UGen returning time values. If this ends, the
25 code::doneAction:: is evaluated.
30 A demand UGen or any other UGen: the number given is the shape
31 number according to link::Classes/Env::.
36 A demand UGen or any other UGen returning curve values. if shape is 5, this is the
39 The possible values are:
42 ## 1 || linear segments, the default
43 ## 2 || natural exponential growth and decay. In this case, the levels must all be nonzero and the have the same sign.
44 ## 3 || sinusoidal S shaped segments.
45 ## 4 || sinusoidal segments shaped like the sides of a Welch window.
46 ## a Float || a curvature value for all segments.
47 ## An Array of Floats || curvature values for each segments.
52 If gate is x ≥ 1, the UGen runs.
55 If gate is 0 > x > 1, the UGen is released at the next
59 If gate is x < 0, the UGen is sampled and held.
64 If reset crosses from non-positive to positive, the UGen is reset
65 at the next level. If it is > 1, it is reset immediately.
70 demand ugen returning level scaling values
75 demand ugen returning level offset values
80 demand ugen returning time scaling values
85 A doneAction that is evaluated when level or duration stream
86 ends. See link::Reference/UGen-doneActions:: for more detail.
92 // frequency envelope with random times
96 freq = DemandEnvGen.ar(
97 Dseq([204, 400, 201, 502, 300, 200], inf),
98 Drand([1.01, 0.2, 0.1, 2], inf) * MouseY.kr(0.01, 3, 1),
99 7 // cubic interpolation
101 SinOsc.ar(freq * [1, 1.01]) * 0.1
106 // frequency modulation
110 list = { exprand(200, 1000.0) } ! 32;
111 freq = DemandEnvGen.ar(
112 { Dseq(list.scramble, inf) } ! 2,
113 SampleDur.ir * MouseY.kr(1, 3000, 1),
114 5, // curve interpoaltion
115 MouseX.kr(-0.01, -4) // curve must be negative for fast interpol.
117 SinOsc.ar(freq) * 0.1
124 // mouse x on right side of screen toggles gate
128 freq = DemandEnvGen.kr(
129 Dwhite(300, 1000, inf).round(100),
131 5, 0.3, // curve: 0.3
135 SinOsc.ar(freq * [1, 1.21]) * 0.1
140 // sample and hold (0.5 > gate > 0)
141 // mouse x on right side of screen toggles gate
142 // mouse y scales frequency
146 freq = DemandEnvGen.kr(
147 Dwhite(300, 1000, inf).round(100),
150 MouseX.kr > 0.5 + 0.1
152 SinOsc.ar(freq * [1, 1.21]) * 0.1
158 // mouse x on right side of screen toggles gate
159 // mouse button does soft reset
163 freq = DemandEnvGen.kr(
164 Dseq([Dseries(400, 200, 5), 500, 800, 530, 4000, 900], 2),
165 Dseq([0.2, 0.1, 0.2, 0.3, 0.1], inf),
166 Dseq([1, 0, 0, 6, 1, 1, 0, 2], inf), // shapes
168 MouseX.kr > 0.5, // gate
169 MouseButton.kr > 0.5, // reset
172 SinOsc.ar(freq * [1, 1.001]) * 0.1
179 // mouse x on right side of screen toggles sample and hold
180 // mouse button does hard reset
184 freq = DemandEnvGen.kr(
185 Dseq([Dseries(400, 200, 5), 500, 800, 530, 4000, 900], 2),
188 MouseX.kr > 0.5 - 0.1, // gate: sample and hold
189 MouseButton.kr > 0.5 * 2, // hard reset
192 SinOsc.ar(freq * [1, 1.001]) * 0.1
201 // short sequence with doneAction, linear
205 freq = DemandEnvGen.kr(
206 Dseq([1300, 500, 800, 300, 400], 1),
211 SinOsc.ar(freq * [1, 1.01]) * 0.1
216 // short sequence with doneAction, step
220 freq = DemandEnvGen.kr(
221 Dseq([1300, 500, 800, 300, 400], 1),
226 SinOsc.ar(freq * [1, 1.01]) * 0.1
237 freq = DemandEnvGen.kr(
242 SinOsc.ar(freq * [1, 1.01]) * 0.1
249 // random gate: release. gate low level > 0.
250 // only end points are kept as release levels
254 freq = DemandEnvGen.kr(
255 Dseq([500, 800], inf),
258 ToggleFF.kr(Dust.kr(5)) + 0.1 // gate
262 SinOsc.ar(freq * [1, 1.01]) * 0.1
267 // random gate: sample and hold. gate low level = 0.
271 freq = DemandEnvGen.kr(
272 Dseq([500, 800, 600], inf),
275 ToggleFF.kr(Dust.kr(5)), // gate
279 SinOsc.ar(freq * [1, 1.01]) * 0.1
291 Dwhite(-0.1, 0.1, inf),
292 SampleDur.ir * MouseY.kr(0.5, 20),
305 Dbrown(-0.1, 0.1, 0.1, inf),
306 SampleDur.ir * MouseY.kr(1, 100, 1)
318 Server.internal.boot;
325 Dseq([Dseries(-0.1, 0.01, 20)], inf),
326 SampleDur.ir * MouseY.kr(1, 100, 1),
329 Impulse.ar(MouseX.kr(1, SampleRate.ir * MouseX.kr(0.002, 1, 1), 1), 0, 1.5)
343 Dseq([Dseries(-0.1, 0.01, 20)], inf),
344 SampleDur.ir * MouseY.kr(1, 100, 1),
347 Impulse.ar(MouseX.kr(1, SampleRate.ir * MouseX.kr(0.002, 1, 1), 1)) + [0, 0.3]
357 // hardsyncing a saw, som random elements
362 Dseq([Dseries(-0.1, 0.01, 20), Dseries(-0.1, 0.01, 20), Dwhite(-0.1, 0.1, 5)], inf),
363 SampleDur.ir * MouseY.kr(1, 100, 1),
366 Impulse.ar(MouseX.kr(1, SampleRate.ir * MouseX.kr(0.002, 1, 1), 1), 0, 1.5)
374 // softsyncing a saw, som random elements
379 Dseq([Dseries(-0.1, 0.01, 20), Dseries(-0.1, 0.01, 20), Dwhite(-0.1, 0.1, 5)], inf),
380 SampleDur.ir * MouseY.kr(1, 100, 1),
381 1, 0, // linear interpolation
383 Impulse.ar(MouseX.kr(1, SampleRate.ir * MouseX.kr(0.002, 1, 1), 1))
392 // multichannel expansion
393 // mouse x on right side of screen toggles gate
394 // mouse y controls speed
399 freq = DemandEnvGen.kr(
400 { Dseq([300, 800, Drand([1000, 460, 300], 1), 400], inf) + 3.0.rand } ! 2,
401 MouseY.kr(0.001, 2, 1),
405 SinOsc.ar(freq) * 0.1