I made a synth with the low pass filter controlled by a triangle LFO. It took me a solid 20 minutes to figure out that what I thought was a problem with using `.exprange`

on the output of the LFO was actually a problem with the SynthDef arguments.

I was thinking in CPM, so naturally

440 cycles / 60 seconds → |modFreq = 440/60|

but this doesn’t work and I’m wondering why using a fraction wouldn’t work as a SynthDef argument on compile. It works with `Synth.(\key).set`

but not as a default.

```
(
//LFO freq == 440 cpm; modFreq arg is unused in function
SynthDef(\filtSaw, {
arg amp=1, pan=0, freq=60, detun=0.5, fFreqLo=20, fFreqHi=1500, modFreq=440/60, dur=5;
var sig, env, filtMod;
filtMod = LFTri.ar(22/3, 0.0).exprange(fFreqLo,fFreqHi);
env = EnvGen.ar(Env.triangle(dur), doneAction:2);
sig = 7.collect({
LFSaw.ar(freq*rand2(detun).midiratio, 4.0.rand)/7;
});
sig = Mix.ar(sig);
sig = RLPF.ar(sig, filtMod, 0.3);
sig = Pan2.ar(sig, pan);
sig = sig * amp * env;
Out.ar(0, sig);
}).add;
//LFO freq == \modFreq == 440/60
SynthDef(\filtSaw1, {
arg amp=1, pan=0, freq=60, detun=0.5, fFreqLo=20, fFreqHi=1500, modFreq=440/60, dur=5;
var sig, env, filtMod;
filtMod = LFTri.ar(modFreq, 0.0).exprange(fFreqLo,fFreqHi);
env = EnvGen.ar(Env.triangle(dur), doneAction:2);
sig = 7.collect({
LFSaw.ar(freq*rand2(detun).midiratio, 4.0.rand)/7;
});
sig = Mix.ar(sig);
sig = RLPF.ar(sig, filtMod, 0.3);
sig = Pan2.ar(sig, pan);
sig = sig * amp * env;
Out.ar(0, sig);
}).add;
//modFreq as a variable
SynthDef(\filtSaw2, {
arg amp=1, pan=0, freq=60, detun=0.5, fFreqLo=20, fFreqHi=1500, dur=5;
var sig, env, filtMod, modFreq=440/60;
filtMod = LFTri.ar(22/3, 0.0).exprange(fFreqLo,fFreqHi);
env = EnvGen.ar(Env.triangle(dur), doneAction:2);
sig = 7.collect({
LFSaw.ar(freq*rand2(detun).midiratio, 4.0.rand)/7;
});
sig = Mix.ar(sig);
sig = RLPF.ar(sig, filtMod, 0.3);
sig = Pan2.ar(sig, pan);
sig = sig * amp * env;
Out.ar(0, sig);
}).add;
//impractical for this purpose but works
SynthDef(\filtSaw3, {
arg amp=1, pan=0, freq=60, detun=0.5, fFreqLo=20, fFreqHi=1500, dur=5, modFreq=7.333333;
var sig, env, filtMod;
filtMod = LFTri.ar(modFreq, 0.0).exprange(fFreqLo,fFreqHi);
env = EnvGen.ar(Env.triangle(dur), doneAction:2);
sig = 7.collect({
LFSaw.ar(freq*rand2(detun).midiratio, 4.0.rand)/7;
});
sig = Mix.ar(sig);
sig = RLPF.ar(sig, filtMod, 0.3);
sig = Pan2.ar(sig, pan);
sig = sig * amp * env;
Out.ar(0, sig);
}).add;
//best solution
SynthDef(\filtSaw4, {
arg amp=1, pan=0, freq=60, detun=0.5, fFreqLo=20, fFreqHi=1500, dur=5, modCpm=440;
var sig, env, filtMod, modFreq;
modFreq = modCpm/60;
filtMod = LFTri.ar(modFreq, 0.0).exprange(fFreqLo,fFreqHi);
env = EnvGen.ar(Env.triangle(dur), doneAction:2);
sig = 7.collect({
LFSaw.ar(freq*rand2(detun).midiratio, 4.0.rand)/7;
});
sig = Mix.ar(sig);
sig = RLPF.ar(sig, filtMod, 0.3);
sig = Pan2.ar(sig, pan);
sig = sig * amp * env;
Out.ar(0, sig);
}).add;
)
Synth(\filtSaw); //expected result
Synth(\filtSaw1); //|modFreq = 440/60| doesn't work...
Synth(\filtSaw1).set(\modFreq, 440/60); //magic! now it works
Synth(\filtSaw2); //bad temporary solution
Synth(\filtSaw3); //annoying but works
Synth(\filtSaw4); //best solution probably?
```