Hi guys, i’m trying to understand the examples of convolution2 in the help file but i can’t figure out what b.zero mean for the buffer and also b.set, can you help me with thiat? thankyou !
( // allocate three buffers
b = Buffer.alloc(s,2048);
c = Buffer.alloc(s,2048);
d = Buffer.alloc(s,2048);
b.zero;
c.zero;
d.zero;
)
(
50.do({ |it| c.set(20*it+10, 1.0.rand); });
3.do({ |it| b.set(400*it+100, 1); });
20.do({ |it| d.set(40*it+20, 1); });
)
(
SynthDef("conv-test", { |out, kernel, trig = 0|
var input;
input = Impulse.ar(1);
//must have power of two framesize
Out.ar(out, Convolution2.ar(input, kernel, trig, 2048, 0.5));
}).add
)
x = Synth.new("conv-test",[\kernel,b.bufnum]);
// changing the buffer number:
x.set(\kernel,c.bufnum);
x.set(\trig,0);
x.set(\trig,1); // after this trigger, the change will take effect.
x.set(\kernel,d.bufnum);
x.set(\trig,0);
x.set(\trig,1); // after this trigger, the change will take effect.
d.zero;
40.do({ |it| d.set(20*it+10, 1); });// changing the buffers' contents
x.set(\trig,0);
x.set(\trig,1); // after this trigger, the change will take effect.
x.set(\kernel,b.bufnum);
x.set(\trig,0);
x.set(\trig,1); // after this trigger, the change will take effect.
another thing: in the example it says that after trig:1 the change will take effect, but i don’t hear nothing different