When using buffer with bufnum 0 TGrains3 will output silence.
Bufnums > 0 work as expected.
// s.sendMsg(\b_allocRead, 10, "sounds/a11wlk01.wav"); // original line from help file
s.sendMsg(\b_allocRead, 0, Platform.resourceDir +/+ "sounds/a11wlk01.wav"); // modified bufnum 0
c=Buffer.alloc(s, s.sampleRate * 0.2, 1)
// buffer for rise/decay shape - multiple of sr helps prevent clicks, i think.
(
var y, h;
y=Signal.hanningWindow(s.sampleRate * 0.4); // twice the size of our buffer, 'cause we only use 1/2
h=Array.fill(s.sampleRate * 0.2, {|i| y[i]});
c.loadCollection(h);
)
(
{
var b = 0, trate, dur, clk; // b equals bufnum from above
trate = MouseY.kr(2,200,1);
dur = 4 / trate;
clk = Dust.kr(trate);
TGrains3.ar(2, clk, b, 1.0, LFNoise2.kr(0.5).range(0, BufDur.kr(b)) + TRand.kr(0, 0.02, clk), dur, 0, 0.1, MouseX.kr(0.003, 0.01), 0.007, c.bufnum, 4);
}.play;
)
When using buffer with bufnum 0 TGrains3 will output silence.
Bufnums > 0 work as expected.