I’m trying out a sample in a pattern. The pattern (or sample) gets delayed when I trigger it. It doesn’t seem to start at the exact beginning.
s.boot;
p = ProxySpace.new.push;
t = TempoClock(120/60).permanent_(true)
t.tempo_(1)
~pat.play;
~pat.fadeTime_(1)
~pat.quant_(1)
(
b = Buffer.read(s, ); //5 second drum loop
SynthDef(\samp, {|out=0, prate = 1.0, amp=0.1, pan=0, bufNum = 0, startPos = 0, trig = 1.0|
var source, env;
source = PlayBuf.ar(2, bufNum, prate, trig, startPos, doneAction: 2);
env = Env.adsr(0.01, 2.1, 0.6, 1.8, amp).kr(Done.freeSelf, \gate.kr(1));
Out.ar(out, Pan2.ar(source * env * amp, pan)*20);
}).add;
)
(
~pat=
Pbind(\instrument, \samp,
\startPos, 0,
\bufnum, 0,
\dur, 3,
\prate, 0.9,
\amp, 0.1
)
)
(
~pat=
Pbind(\instrument, \samp,
\startPos, 0,
\bufnum, 0,
\dur, 3,
\prate, 0.9,
\amp, 0.1
)