While analyzing the example file drummer I noticed that both an argument and variable are called the same , tempo
The argument \tempo is a number , and the variable tempo is an Impulse osc.
The speed of the Impulse osc is set by the argument ‘tempo’ , and is then used to control a pulsedivider .
I did something similar , and abviously the use of the same name is giving an error , therefore I renamed the argument \tempo to \Wempo
My question is , in the example file the pulsedivider’s first argument \ tempo , is that the tempo argument or the var temp argument ( the impulse osc ) ?
I assume it’s the impulse osc since there are no conflicts .
The first file is the example ,the second one is my file ’
// (thor magnusson) (2006)
// An instrumentalist inside a synthdef.
(
SynthDef(\drummer, { arg out=0, tempo=4;
var snare, base, hihat;
tempo = Impulse.ar(tempo); // for a drunk drummer replace Impulse with Dust !!!
snare = WhiteNoise.ar(Decay2.ar(PulseDivider.ar(tempo, 4, 2), 0.005, 0.5));
base = SinOsc.ar(Line.ar(120,60, 1), 0, Decay2.ar(PulseDivider.ar(tempo, 4, 0), 0.005, 0.5));
hihat = HPF.ar(WhiteNoise.ar(1), 10000) * Decay2.ar(tempo, 0.005, 0.5);
Out.ar(out,(snare + base + hihat) * 0.4 ! 2)
}).add;
)
a = Synth(\drummer);
a.set(\tempo, 6);
a.set(\tempo, 18);
a.set(\tempo, 180); // check the CPU! no increase.
a.free;```
////my file
(
{
arg modamount=10,wempo=2;
var modenv,ampenv,mod,signal,env,temp,pdv;
temp=Impulse.ar(wempo);
pdv=PulseDivider.ar(temp,1,4);
mod=SinOsc.ar(440/2)*modamount;
modenv=EnvGen.ar(Env([0,1,0],[0.001,0.500],[0,-3]),pdv);
ampenv=EnvGen.ar(Env([0,1,0],[0.001,0.500],[0,-3]),pdv);
signal=SinOsc.ar(220,mod*modenv)*0.3 ;
signal=signal*ampenv;
signal!2;
}.play
)
///