Currently I just enclose multiple Pdefs and play , and atm it seems that the overall timing sync of both Pdef is pretty o.k .
Playing a standard 4/4 kick (0.5sec=2hz ) against 16th notes (0.25sec , 4hz ) and no audible loss of sync
Much better compared to max scheduler
Anything I should be aware off ?
(
SynthDef(\twoop,
{
|fmamt=2,modoffset=24,moatt=0.001,modrel=0.500,ampatt=0.001,amprel=0.800,pitch=48,outt=0.3|
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
);
//////////
(
Pdef(
\crt,
Pbind(
\instrument,
\twoop,
\pitch,Pseq([72,60,71,64,62,48,50,74,55,67,64],inf)-12,
\dur,Pseq([0.25, 0.25, 0.5, 0.25, 0.25, 0.5],inf),
\fmamt,Pseq([2,0.5,2,1,2,1,12,4],inf),
\modrel,Prand([0.425,0.525,0.500,0.550,1,0.625,0.500,0.5,2.8],inf),
\modoffset,Prand([-0.6,0.2,-12.2,0.3,0.6,0.3],inf),
)
)
)
/////0.25, 0.25, 0.25, 0.25, 0.5, 0.25, 0.25, 0.12, 0.12, 0.5, 0.25, 0.50, 0.25, 0.25
(
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;
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;
Out.ar(0,kick);
}).add;
)
////////////
(
Pdef(\kik,
Pbind(\instrument,\kick,
\dur,Pseq([0.5,0.5],inf),
\pitch,Pseq([40,42,39],inf),
\pdec,0.8,
\shamt,Pseq([4,2],inf),
\vol,0.5,
))
)
///////////
(
Pdef(\crt).play;
Pdef(\kik).play;
)
(
Pdef(\crt).stop;
Pdef(\kik).stop;
)