Hi all
I am making a microtonic clone again ( already did one in reaktor )
At the moment there are three oscillators , sine ,saw, triangle and their frequency can be modulated by an lfo ( audio rate ) , envelope or s/h ( audio rate gives noise ) or all at once .
In microtonic there is the option to select which osc to route to the output
So I declared a new variable z with an array that houses all osc’s ( the modulation of the osc’s is already done on their respective codeline )
Next is a Select.ar , the ffirst argument 'which 'is the array ( previous line ), the next argument ‘array’ is the variable for the osc selection
When I want to make a synthdef , the second argument of the select module needs the already declared variables ( sine,saw ,tri) and I would like these to have a different name for dynamic switching .
Don’t mind the parameters at the bottom , since the synthdef is not yet created
Edit …seems that I don’t know exactly how the select module works , it’s confusing since the second argument is called “array” and the first ‘which’’, but choosing the array called z as the first arg , and osc as second it works as expected …maybe the parameters are mixed up ?
Either way , the issue is still .to rename the already declared variables
(
{ arg freq1=50,lfofreq=200 ,lfoamount=500,penvamount=2000,
decaycurve=(-5),patt=0.001,pdec=4.500,shamount=0,shrate=3,
ampatt=0.001,ampdec=2,ampdecaycurve=(-5);
var sin,tri,saw,lfo,modsh,penv,ampenv,sh;
sh=LFNoise0.ar(shrate)*shamount;
penv=EnvGen.ar(Env([0,1,0],[patt,pdec],[0,decaycurve]),doneAction:0)*penvamount;
ampenv=EnvGen.ar(Env([0,1,0],[ampatt,ampdec],[0,ampdecaycurve]),doneAction:0);
lfo=SinOsc.ar(lfofreq)*lfoamount;
sin=SinOsc.ar(freq1+penv+lfo+sh)*ampenv;
tri=LFTri.ar(freq1+ penv +lfo+sh)*ampenv;
saw=LFSaw.ar(freq1+penv+lfo+sh)*ampenv;
z=[sin,tri,saw];
Select.ar(z,sin);//////////I want to give the second argument a new name so I can dynamically select it
}.play
)
//////////////////////////
(\freq1,100)
(\penvamount,2000)/////pitch env amount
(\lfofreq,0) /////LFO frequency
(\lfoamount,200)///lfo amount
(\shrate,10)////////shrate
(\shamount,10)//////////shamount
(\ampatt,0.001)/////amp attack
(\ampdec,0.750)//////amp decay
(\ampdecaycurve,-5)////ampdecay curve