Pmono inside Pspawner

Hey there, I have been having trouble using Pmono inside pspawner. Particularly, I can’t work out why the suspend method doesn’t seem to work on a Pmono inside an sp.par or an sp.seq call. I understand they’re functionally different types of streams, but I’d really like to have the same behaviour if anyone has any ideas

this works:

(    
    Pspawner({| sp |
        var mono;
        \a.postln;
        mono = sp.par(
            Pbind(\a, 0, \b, 1)
        );
    
        sp.wait(8);
        \b.postln;
        sp.suspend(mono);
        mono = sp.par(
            Pbind(\a, 0, \b, 1, \octave, 6)
        );
        sp.wait(8);
        sp.suspendAll();
    }).play(t)
)

this doesn’t?

(    
    Pspawner({| sp |
        var mono;
        \a.postln;
        mono = sp.par(
            Pmono(\default, \a, 0, \b, 1)
        );
    
        sp.wait(8);
        \b.postln;
        //'mono' does not suspend?
        sp.suspend(mono);
        mono = sp.par(
            Pmono(\default, \a, 0, \b, 1, \octave, 6)
        );
        sp.wait(8);
        sp.suspendAll();
    }).play(t)
)

suspend does pause the Pmono but does not release the note:

a = Spawner({ |sp | 100.do{ sp.wait(1) } });
a.play;
b = a.par(Pmono(*[\default,degree: Pwhite(0, 10), dur: 0.2]));
a.suspend(b)
a.par(b)

this makes sense since the Pmono is just a stream of \set messages to the synth.

Makes sense, but I’d still like to find a solution: .stop doesnt seem to work either, nor does putting the Pmono inside a Pdef and calling stop or clear on the Pdef.

I think on consideration that this is a bug -

.pause does release the synth on a Pmono so there I would expect the same behavior here.

I think the solution is to simply use a Routine for this kind of thing - using either Patterns or Pdefs and the stop pause and resume methods I have trouble seeing any specific use case for Pspawner that isn’t covered. lmk if there’s something I’m missing.

(
fork{
	var b, a = Pmono(\default, \freq,666).play;
	2.wait;
	b = Pbind(*[freq: Pwhite(400,440.0, 40), dur: 0.1]).play;
	2.wait;
	a.stop; 
	1.wait;
	b.pause;
	1.wait;
	b.resume;
};
)

(
fork{
	Pdef(\mono, Pmono(\default, \freq, 555)).play(quant:0);
	2.wait;
	Pdef(\mono, Pmono(\default, \freq, Pwhite(300,334,9),\dur,0.1))
}
)

Hmmm yeah, it should be fine to convert my tracks to .fork, but I was using the fade and quant times of a Pspawner wrapped in a Pdef for transitioning between sections in live sets

one possibility would be to reach into Pspawner and fix this - I didn’t see how on first glance but it should be doable…

But perhaps Ndef or NodeProxy hosting patterns could help here?

I’m having a go at fixing this, but I’m not familiar enough with writing sc classes to really do anything useful. @jamshark70 would you be able to have a look if you have time?

Based on work pressures for… well, for the next 2-3 weeks, I can handle 5 minute spot posts but I’m not going to have any sustained time for development, likely for the rest of December.

Sorry…
hjh

1 Like

for now it seems the solutions in this thread work quite well :slight_smile: Stopping an event with infinite duration - #10 by RFluff

1 Like