2 summary:: Buffer granulator.
3 categories:: UGens>Buffer, UGens>Generators>Granular
6 Triggers generate grains from a buffer. Each grain has a Hanning envelope
8 (sin2(x) for x from 0 to π)
10 and is panned between two channels of multiple outputs.
17 Number of output channels.
20 At each trigger, the following arguments are sampled and used as
21 the arguments of a new grain. A trigger occurs when a signal
22 changes from non-positive to positive value.
24 If the trigger is audio rate then the grains will start with
28 The index of the buffer to use. It must be a one channel (mono)
32 1.0 is normal, 2.0 is one octave up, 0.5 is one octave down -1.0
33 is backwards normal rate… etc.
36 The position in the buffer in seconds at which the grain envelope
37 will reach maximum amplitude.
40 Duration of the grain in seconds.
43 A value from -1 to 1. Determines where to pan the output in the
45 link::Classes/PanAz:: .
48 Amplitude of the grain.
51 1, 2, or 4. Determines whether the grain uses (1) no
52 interpolation, (2) linear interpolation, or (4) cubic
66 b = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav");
71 trate = MouseY.kr(2,200,1);
73 rate = Dseq([10, 1, 1, 0.5, 0.5, 0.2, 0.1], inf);
74 TGrains.ar(2, Impulse.ar(trate), b, rate, MouseX.kr(0,BufDur.kr(b)), dur, Dseq([-1, 1], inf), 0.1, 2);
80 var trate, dur, clk, pos, pan;
81 trate = MouseY.kr(8,120,1);
83 clk = Impulse.kr(trate);
84 pos = MouseX.kr(0,BufDur.kr(b)) + TRand.kr(0, 0.01, clk);
85 pan = WhiteNoise.kr(0.6);
86 TGrains.ar(2, clk, b, 1, pos, dur, pan, 0.1);
93 var trate, dur, clk, pos, pan;
94 trate = MouseY.kr(8,120,1);
96 clk = Impulse.kr(trate);
97 pos = MouseX.kr(0,BufDur.kr(b)) + TRand.kr(0, 0.01, clk);
98 pan = WhiteNoise.kr(0.6);
99 TGrains.ar(4, clk, b, 1, pos, dur, pan, 0.1);
105 var trate, dur, clk, pos, pan;
106 trate = MouseY.kr(8,120,1);
108 clk = Dust.kr(trate);
109 pos = MouseX.kr(0,BufDur.kr(b)) + TRand.kr(0, 0.01, clk);
110 pan = WhiteNoise.kr(0.6);
111 TGrains.ar(2, clk, b, 1, pos, dur, pan, 0.1);
119 var trate, dur, clk, pos, pan;
120 trate = LinExp.kr(LFTri.kr(MouseY.kr(0.1,2,1)),-1,1,8,120);
122 clk = Impulse.ar(trate);
123 pos = MouseX.kr(0,BufDur.kr(b));
124 pan = WhiteNoise.kr(0.6);
125 TGrains.ar(2, clk, b, 1, pos, dur, pan, 0.1);
132 var trate, dur, clk, pos, pan;
134 dur = MouseY.kr(0.2,24,1) / trate;
135 clk = Impulse.kr(trate);
136 pos = MouseX.kr(0,BufDur.kr(b)) + TRand.kr(0, 0.01, clk);
137 pan = WhiteNoise.kr(0.6);
138 TGrains.ar(2, clk, b, 1, pos, dur, pan, 0.1);
144 var trate, dur, clk, pos, pan;
147 clk = Impulse.kr(trate);
148 pos = Integrator.kr(BrownNoise.kr(0.001));
149 pan = WhiteNoise.kr(0.6);
150 TGrains.ar(2, clk, b, 1, pos, dur, pan, 0.1);
156 var trate, dur, clk, pos, pan;
157 trate = MouseY.kr(1,400,1);
159 clk = Impulse.kr(trate);
160 pos = MouseX.kr(0,BufDur.kr(b));
161 pan = WhiteNoise.kr(0.8);
162 TGrains.ar(2, clk, b, 2 ** WhiteNoise.kr(2), pos, dur, pan, 0.1);
170 trate = MouseY.kr(2,120,1);
172 TGrains.ar(2, Impulse.ar(trate), b, (1.2 ** WhiteNoise.kr(3).round(1)), MouseX.kr(0,BufDur.kr(b)), dur, WhiteNoise.kr(0.6), 0.1);
177 // demand ugens as inputs
180 var trate, dur, z, d;
181 trate = MouseX.kr(1, 100, 1);
182 d = { Dwhite(0.1, 0.2, 1) };
184 Drand([Dgeom(0.1, 1 + d.value, Diwhite(20, 40)), Dgeom(1, 1 - d.value, Diwhite(20, 40))])
189 rate: Dseq([1, 1, z.value, 0.5, 0.5, 0.2, 0.1, 0.1, 0.1, 0.1], inf) * 2 + 1,
190 centerPos: Dseq(z.dup(8), inf),
191 dur: Dseq([1, d.value, 1, z.value, 0.5, 0.5, 0.1, z.value] * 2, inf) / trate,
192 pan: Dseq([1, 1, 1, 0.5, 0.2, 0.1, 0, 0, 0], inf) * 2 - 1,
193 amp: Dseq([1, 0, z.value, 0, 2, 1.0, 1, 0.1, 0.1], inf)