Parallel routines

Hi there,

I am trying to understand how to play several instances of the same routine, with the second instance starting before the first ends. I’d have a routine such as this:

r = Routine{
	var rrr = rrand(0.0,1.0);{rrr.postln;


This runs for a total of 1 second. I want to call this routine again, say, 0.75 seconds after I called it for the first time, to output a different random number. What would be the best approach here? With patterns, I guess this could be done with some combination of Pspawner and Plazy, but I’d like to keep using routines here.


1 Like

Maybe something like this?

r =  {
	var rrr = rrand(0.0, 1.0);
	"--------".post;; "--------".postln; {

Routine{ loop {

Take a look at Tdef, it has some nice features.

Excellent, thanks so much. This works perfectly.

1 Like