Reset issue in a Routine

Hi everyone!
Newbie question here: I try to sequence several events, and loop the whole thing :

(
Routine.new{({
	~nappe1a.play;
	rrand(25,35).wait;
	~nappe1b.play;
	rrand(45,55).wait;
	~poeme.play;
	rrand(2,4).wait;
	~sample.play;
	rrand(100,130).wait;
	~sample.stop;
	rrand(30,40).wait;
	~nappe1b.stop;
	rrand(15,20).wait;
	~poeme.stop;
	rrand(2,4).wait;
	~nappe1a.stop;
	rrand(15,20).wait;
	~poeme.play;
	rrand(15,20).wait;
}).loop;
}.play;
)

The events (~nappe1a, ~poeme, etc.) are “Tasks”. One of them, ~poeme, is not played when the loop is repeated, and I don’t understand why:

~poeme = Task.new({
		Synth.new(\playerMono, [
	\buf, [~voix[0],~voix[1],~voix[2],~voix[3],~voix[4]].choose,
	\amp, 0.5,

])
	});

I guess it’s a “reset” problem, but if I put a reset in my final Routine, it doesn’t work either…
Would anyone understand what the problem is?

you want to reset after stopping:

~poeme.stop;~poeme.reset;

then the next time you call play on ~poeme it will play…

but there is another problem - you have ~poeme .play twice in the loop but ~poeme.stop only once.

You should understand though that calling stop on the Task does not stop the synth that you started!

1 Like

Thank you so much. I feel silly, it was so simple!

Alternately: ~poeme.play(doReset: true).

hjh

1 Like

Thank you, that’s more elegant! :blush:

can also omit .stop in this case and type ~poeme.reset.play for fewer keystrokes…

1 Like