Hello;
I have this script:
~amb0.clear(4)
~amb0.play;
~amb0.pause
~amb0.play; ~amb0.awake_(false);
~amb0 = {
//var rates = Pxrand([0.7, 0.1, 1, 0.5, 2], inf).asStream.next;
var sig , env;
env = Env.asr(\atk.ir(4), \sus.ir(4), \rel.ir(2)).ar(2);
sig = PlayBuf.ar(1,d["voces"][0], rate:1,startPos:0.1, loop:1);
sig = sig*env;
sig = Pan2.ar(sig,0 )*1;
};
(
~m = Tdef(\m, {
var rates = Pxrand([0.7, 0.1, 1, 0.5, 2], inf).asStream.next;
loop{
~amb0.spawn([\rate, rates]); // Ejecuta la función y reproduce el sonido
15.wait; // Espera 15 segundos
};
});
)
~m.play
~m.clear
I want the audio file to play at a different rate each time it is repeated in the task. I have looked for several solutions but always get the same result: when I run the Tdef, it takes one rate and stays there forever.
How can I do this dynamically in a Tdef or in the function (I know that in a Pbind this would be easy)?
Thank you.