Excited to read in thor Magnusson guide that Pdefs can be set from outside just like Synthdefs
However , I don’t get the expected results
The sc manual is imho verry scarce when it comes to info about Pdef.set
I tried it with assigning the pdefs to variables and without , both set parameters do nothing
https://thormagnusson.gitbooks.io/scoring/content/PartIV/chapter16.html
(
SynthDef (\kick,
{
arg pitch=50,patt=0.001,pdec=0.325,pcurve=(-50),pamt=100,att=0.001,dec=0.700,noisefreq=100,shamt=4,vol=0.3,out;
var kick,penv,ampenv,noiseosc;
penv=EnvGen.ar(Env([0,1,0],[patt,pdec],[0,pcurve]),doneAction:2);
kick=SinOsc.ar(pitch+(penv*pamt))*0.9;
noiseosc=LPF.ar(WhiteNoise.ar(0.1),noisefreq);
kick=(noiseosc+kick)*EnvGen.ar(Env([0,1,0],[att,dec],[0,-5]))!2;
kick=SineShaper.ar(kick*shamt)*vol;
kick=(HPF.ar(kick,20));
Out.ar(out,kick);
}).add
)
//
t=TempoClock(124/60).permanent_(true)
(~ward=(
Pdef(\kik,
Pbind(\instrument,\kick,
\dur,1/2,
\pitch,Pseq([50,75],inf),
\pdec,0.8,
\shamt,Pseq([2,8,2,2],inf),
\vol,0.5,
\out,0,
))
)
)
~ward=Pdef(\kik).set(\dur,1/4);
~ward=Pdef(\kik).set(\dur,1/4,\pitch,Pseq([50,75,120,75]));
~ward=Pdef(\kik).play(t)
~ward.stop
~ward.pause
This is Thor magnusson’s example , I replaced the instrument with my kick instrument , the changes also don’t work , after the necessar changes freq to pitch etc
(
Pdef(\scale, Pbind( \instrument,\kick,
\freq, Pseq([62, 64, 67, 69, 71, 74], inf).midicps,
\dur, Pseq([0.25, 0.5, 0.25, 0.25, 0.5, 0.5], inf)
));
)
a = Pdef(\scale).play;
a.pause // pause. the stream
a.resume // resume it
a.stop // stop it (resets it)
a.play // start again
Pdef(\scale).set(\out, 20); // outbus 20
Pdef(\scale).set(\out, 0); // outbus 0
// here we set the duration of the envelope in our instrument
Pdef(\scale).set(\envdur, 0.2);
Pdef(\scale).set(\freq, Pseq([72,74,72,69,71,74], inf).midicps);