Thank you for the example. I modified your slowAttack Pbind so that the sound with slow attack starts from the first beat rather than the second. But it seems that in this case, the negative numbers do not work well:
Pbind(\instrument, \slowAttack,
\dur, ~dur,
\att, Pwhite(0.1,~dur).trace,
\degree, Prand((0..16), inf),
\lag, Pkey(\att).neg.trace
)
On the other hand, it works in negative values in this example with samples:
// 2 soundfiles. One with a slow attack, the other with a quick attack:
(
~slowAtk = Buffer.read(s, "~/son/sons/cuisine/boisson/bouchon/bouchon_H_LtAtk01.wav");
~quickAtk = Buffer.read(s, "~/son/sons/cuisine/boisson/bouchon/bouchon_H_Se01.aiff");
)
// a SynthDef to play the sounds:
(
SynthDef(\bufplay, {
arg buf=0, amp=1, pos=0, out;
var sig;
sig = PlayBuf.ar(numChannels:1, bufnum:buf, rate:BufRateScale.ir(buf), doneAction:2);
sig = sig*amp;
Out.ar(out, sig!2);
}).add;
)
// a Pbind that sequences both sounds
(TempoClock.default.tempo = 200/60;
Pbind( \instrument, \bufplay,
\dur, Pseq([1, 1, 0.5, 0.5, 1], inf),
\buf, Pseq([~slowAtk, ~quickAtk],inf),
// \lag: offset in seconds — \timingOffset: offset in beats
\lag, Pfunc({|r| switch(r.buf,
~slowAtk, -0.1, //0.1 seconds in negative (-0.1) to compensate for the slow attack of the sound
~quickAtk, 0
)}),
).play;
)
The question is: why does it work in one case and not in the other …