I’ve read and saw on multiple tutorials that pbinds can be realtime manipulated and launched without invoking another stream.
Whenever I do that , another instance of pbind is launched .
I am also having issues with the variable assigned to a pbind , in the first example it works , var q is used to launch and stop the pbind
In the second example it doesn’t
The differnce is that in the first example I just used a Pbind , the second is a Pbind within a Pdef ,
(
SynthDef(\twoop,
{
|fmamt=2,modoffset=24,moatt=0.001,modrel=0.500,ampatt=0.001,amprel=0.800,pitch=48,outt=0.5|
var mod,modenv,ampenv,carr;
mod=SinOsc.ar((pitch+modoffset).midicps)*fmamt;
modenv=EnvGen.ar(Env.perc(moatt,modrel),doneAction:0);
ampenv=EnvGen.ar(Env.perc(ampatt,amprel),doneAction:2);
carr=SinOsc.ar(pitch.midicps,(mod*modenv))*ampenv*outt!2;
Out.ar(0,carr);
}).add
)
//////////
(
q=(
Pbind(
\instrument,
\twoop,
\pitch,Prand([48,53,46,65],inf),
\dur,Pseq([1,0.5,0.25,0.5,0.25,0.25,0.25,0.5],inf),
\fmamt,Pseq([2,20,2,1,2,1,8,4],inf),
\modrel,Prand([0.425,0.525,0.500,0.550,1,0.625,0.500,0.5,0.8],inf),
\modoffset,Prand([-0.6,24.3,0.2,12.5,-12.2,12.5,0.3,0.6,0.3],inf),
).play
)
)
q;
q.play;
q.stop;
(
SynthDef (\simple,
{
|att=0.001,dec=0.200,mod=500,pitch=0,filterfreq=400,reso=0.5|
var sig,env;
env=EnvGen.ar(Env([0,1,0],[att,dec],[0,-5]),doneAction:2);
sig=Pulse.ar(pitch.midicps,mul:0.5)+Saw.ar((pitch+0.1).midicps,mul:0.5);///////I an
sig=RLPF.ar(sig,filterfreq+(env*mod).clip(40,20000),rq:reso);
sig=sig*env!2;
Out.ar(0,sig)
}).add
)
(
~ward=(
Pdef(\qwe,
Pbind(\instrument,\simple,
\dur,Pseq([0.12,0.12,0.25],inf),
\pitch,Pseq([60,67,71,48,50,55],inf)-3,
\filterfreq,Prand([400,440,600,400,2000,400,900,350,3000],inf),
\dec,Prand([0.125,0.125,0.125,0.7],inf),
\att,Prand([0.001,0.1,0.001,0.001],inf),
\reso,Pseq([0.5,0.5,0.5,0.2,0.5,0.5,0.1],inf),
).play
)
)
)
~ward.play;
~ward.stop;
/////