I will have a routine multiple times in parallel play

Hey I have a Routine which does technically the job for me.
But I need not one rather I need 6 Instances of this Routine.
This six Instances should play parallel.
So it’s stupid to write the Routine 6 Times.
Are there any other ways do get this run.

A Thomas Lahme from CreCo thanks in advance

Put it in a function. Functions are the most powerful and often underrated thing in supercollider (and most other programming languages).

~my_routine_maker = { 
	Routine.run({ 
		4.rand.wait; 
		"some routine".postln 
	}) 
};

6.do({ ~my_routine_maker.() });

Sorry I today to stupid but what is wrong with this Code
// our Function to build mutltiple Instances
~my_routine_maker = {
// Routine to instance the Synth
Routine.run({
// Stream for chose one Buffer of Sound to Chose
a = Prand([~b1, ~b2, ~b3], inf).asStream;
c = Synth(\help_PlayBuf, [\bufnum, a.next, \temp, -4.4.rand2]);
// Loop for ever to change Play Rate and Bufer to play
loop({
c.set(\temp, -4.4.rand2.round(1), \bufnum, a.next);
// Litle wait to next Change
1.wait;
});
})
};

I must have there a typo so the structure is incorrect and the
Whole Part is not setable.

help! please use code fence ``` before and after block of code so that we can read!

Sorry Error self founded.
I need a braked around the whole Function.
So this thread is solved

Thanks jordan

I see a problem here. You are invoking Synth.new and Synth:set without pre-empting the OSC messages with proper latency to ensure accurate timing. In a Routine, always wrap any calls to these methods in Server.default.bind { ... } or you’ll get weird timing issues.

Dear Nathan,
I very new to SuperCollider all the time.
So I don’t actually understand very good what you mean.
So I know a little bit about OSC Messages.
But I don’t understand why I have to do pre empting here the OSC Messages.
Actually my Program runs.
But I think it would give there any Reasons, please explain.
And it would been great can you show me a way to do it.

or… (and this is really hacky - assume the server can catch up in 1 second) …

do it the other way around…

loop({
   // wait before setting since an initial was already provided.
   1.wait;
   c.set(\temp, -4.4.rand2.round(1), \bufnum, a.next);  
});

I’ve written a post explaining the necessity of using s.bind { ... }: Why you should always wrap Synth(...) and Synth:set in Server.default.bind { ... }