Thanks!
I was hesitant posting the original code is something like this but I didn’t post it because it is kind of a mess. The selection of the buf is dependent of the /dur pattern so it is maybe more complicated?
(
Pdef(\drum,Pbind(
\instrument,\pbsTest,
\dur,Pn(Pseq([1,0.5,0.25,0.25].normalizeSum*1),inf,\step1),
\buf, Pgate(Pseq([d['dubstep_kick'][3]]++ Pxrand(d['voices'][0..30].flat,1),inf),inf,\step1),
\rate,Prand([-6].midiratio,inf)*Pwrand([1,-1],[90,1].normalizeSum,inf),
\stretch,2,
\pos,0,
\amp,0.05,
\loop,Prand([Pn(0,3),Pn(1,1)],inf),
\crv, -15,
\atk,0.06,
/*\sustain, Pfunc{|ev| if(ev[\buf].detect({|item| item == d['dubstep_kick'][3]})) {t.beatDur*Pkey(\stretch)*0.01} {t.beatDur*Pkey(\stretch)*0.25}},*/
\rel, Pkey(\dur)*Pkey(\stretch)*0.25,
\pan,0,
\dA,2,
\out, Ptuple([Pwrand([~bus[\plateReverb],0],[20,90].normalizeSum,1),~bus[\audio1]],inf),
\group, Pfuncn({ ~lowGrp},inf),
\addAction,0
).collect({arg ev; ~eventScr=ev })).play(t)
)