Change a Synths from Pdef which are already playing

Hello everybody. I was wondering if it is possible to change some arguments of all synths that are currently in play from a Pdef / Pbind?

I’m trying to show some example here. The first Pdef, is a continously playing Pattern in a tempo of 60bpm. The latter Pdef only creating one Synth, which is not to be effected by changing the ~amp argument in the following way. I mean this is also not the case in the first example, but appears as if, since the synth gets replaced by another one:

~amp = 0.2; //set an amp
Pdef(\asdf,Pbind(\dur, Pseq([1],inf), \amp,Pfunc{~amp})).play;
~amp=0.05; //changes the amp for the next synth
Pdef(\asdf).stop;
~amp = 0.2; //reset amp
Pdef(\asdf,Pbind(\dur, Pseq([30]))).play; //play the synth a single time
~amp=0.05; //doesnt do anything while playing, since the single note to be played is already created

How is it possible to change the amp for all synth that are currently by a specific Pdef?

Thank you very much!

one possibility is to set the target of all the synths to a Group. Assign ~myGroup = Group.new; then in your Pbinds add the keys \group, ~myGroup. the you can change the \amp key of any synths in your group using ~myGroup.set(\amp,0.05)

1 Like

Thats the trick, thank you!