2 summary:: Demand results from demand rate UGens.
3 related:: Classes/Duty, Classes/TDuty
4 categories:: UGens>Demand
8 When there is a trigger at the trig input, a value is demanded each UGen
9 in the list and output. The unit generators in the list should be
12 When there is a trigger at the reset input, the demand rate UGens in the
21 Trigger. Can be any signal. A trigger happens when the signal
22 changes from non-positive to positive.
25 Trigger. Resets the list of UGens when triggered.
28 List of demand-rate UGens to get values from. When the shortest stream ends, this ugen will set the link::Classes/Done##'done' flag::.
31 By design, a reset trigger only resets the demand ugens; it does not reset the value at Demand's output. Demand continues to hold its value until the next value is demanded, at which point its output value will be the first expected item in the list.
32 To jump to the start value upon receipt of a reset trigger, one can add (+) the two triggers together:
35 a = { |t_trig, t_reset|
36 var d = Demand.kr(t_trig + t_reset, t_reset, Dseries(0, 1, inf));
37 d.poll(t_trig + t_reset);
41 a.set(\t_trig, 1); // do this a few times -- the demand value should increase by 1 each time
42 a.set(\t_reset, 1); // goes immediately back to 0
45 One demand ugen represents a single stream of values, so that embedding the same ugen twice calls this stream twice. To isolate a demand ugen, use a function:
48 var a, b, t = Impulse.kr(2);
49 a = { Dseq([1, 2, 3, 4, 5], inf) } * 100;
51 Demand.kr(t, 0, [a, b]).poll(t)
65 trig = Impulse.kr(24);
66 seq = Drand([Dseq((1..5).mirror1, 1), Drand((4..10), 8)], 2000);
67 freq = Demand.kr(trig, 0, seq * 100);
68 SinOsc.ar(freq + [0,0.7]).cubed.cubed.scaleneg(MouseX.kr(-1,1)) * 0.1;
75 trig = Impulse.kr(12);
76 seq = Drand([Dseq((1..5).mirror1, 1), Drand((4..10), 8)], 2000) * Drand([1,2,4,8],2000);
77 freq = Demand.kr(trig, 0, seq * 100);
78 SinOsc.ar(freq + [0,0.7]).cubed.cubed.scaleneg(MouseX.kr(-1,1)) * 0.1;
87 var freq, trig, reset, seq;
88 trig = Impulse.kr(10);
89 seq = Diwhite(60, 72, inf).midicps;
90 freq = Demand.kr(trig, 0, seq);
91 SinOsc.ar(freq + [0,0.7]).cubed.cubed * 0.1;
97 var freq, trig, reset, seq;
98 trig = Impulse.kr(10);
99 seq = Dseq([72, 75, 79, Drand([82,84,86])], inf).midicps;
100 freq = Demand.kr(trig, 0, seq);
101 SinOsc.ar(freq + [0,0.7]).cubed.cubed * 0.1;
108 var freq, trig, reset, seq;
109 trig = Impulse.kr(10);
112 Diwhite(60, 72, inf),
113 Dseq([72, 75, 79, Drand([82,84,86])], inf)
117 freq = Demand.kr(trig, 0, seq.midicps);
118 SinOsc.ar(freq + [0,0.7]).cubed.cubed * 0.1;
125 var freq, trig, reset, seq1, seq2;
126 trig = Impulse.kr(10);
127 seq1 = Drand([72, 75, 79, 82] - 12, inf).midicps;
128 seq2 = Dseq([72, 75, 79, Drand([82,84,86])], inf).midicps;
129 freq = Demand.kr(trig, 0, [seq1, seq2]);
130 SinOsc.ar(freq + [0,0.7]).cubed.cubed * 0.1;
137 trig = Impulse.kr(8);
139 Dseq([4,0,0,1,2,1,0,1]),
140 Dseq([4,0,2,0,1,0,1,1]),
141 Dseq([4,0,0,2,0,0,1,1]),
142 Dseq([4,0,1,2,0,1,2,0]),
143 Dseq([4,1,1,1,2,2,3,3]),
144 Dseq([4,1,0,1,0,1,0,1])
146 trig = Demand.kr(trig, 0, seq * 0.4) * trig;
147 {LPF.ar(PinkNoise.ar, 5000)}.dup * Decay.kr(trig, 0.5);