Resetting a Pmono

Hello im confused with the Pmono behavior. When .reset -ing a pmono, it will create a new pattern. However is it possible to immediatly free the current synth+Pmono and just reset a new one from the pattern in some kind of method? Or do i need to .stop it and just call itself once again?!
I mean would work, I was just wondering.
Ill explain further in the example, thank you very much!


~p = Pmono(\default, \dur, 0.5, \degree, Pseq([0,1,2,3,4],inf)).play;
//just resetting it, creates a new synth
~p.reset;
//doing them one after the other will reset the pmono from the beginning
//this is how i would want it to be, in one go
~p.pause;
~p.reset;
~p.resume;
//however doing them all at the same time creates an entire synth
(
~p.pause;
~p.reset;
~p.resume;
)

IIRC Pmono depends on .stop to release the synth, so I think the best way is actually to .stop and .play again.

This kind of question can get a bit confusing, and it’s important to be clear which object is doing what.

Pmono defines what to do, but it doesn’t do anything on its own.

.play creates an EventStreamPlayer to perform the behavior defined by the Pmono.

.reset is not a Pmono operation. It’s an EventStreamPlayer operation.

Sometimes we can get trapped into thinking that the player is an important object that should be preserved; “pause-reset-resume” is trying to reuse the same player. But in several pattern-related cases such as this one, it’s better to treat the player as disposable: not reset, but rather, dump the old player and make a new one.

~pattern = Pmono(\default, \dur, 0.5, \degree, Pseq([0,1,2,3,4],inf));

~p = ~pattern.play;

// later
~p.stop;
~p = ~pattern.play;

hjh

1 Like

Yes i see the difference. Thank you very much!