SinOsc as control - basic help

Good morning!
I´m a little unsure of the arithmetic required for using SinOsc as a control wave. Let´s say I want a sine wave to oscillate between two specific values. How do I enter those values into the equation? Could anyone explain this for a math dummy?

In other words,
I have a LPF filter, and I want the cutoff frequency to oscillate every second between 400 and 4000 Hz. How do I do that?,, …?

Hi @askevob,

The easiest way might be something like this:,,1,400,4000));

.linexp will map the output of the sine oscillator (which goes between -1 and 1) to 400 to 4000. You’ll notice that the first two arguments are the input range and the next two are the output range. I chose linexp because an exponential curve between frequencies might make more sense, but could also use linlin which is similar but outputs a linear mapping.

1 Like

You could also do, 4000)
1 Like

I see that you’ve already got some answers. As a MD (math dummy) myself, it’s also worthwhile running/testing your code/solution via a plot method to check before blasting yourself.

{, 1, 400,4000)}.plot(1);

I’d add exprange to your methods which I think will also give the same as linexp.

I often use a different approach:

{arg base=400, amount=0.5; base * ( * amount + 1) }.plot(1);

base is for example the cutoff frequency of LPF
when amount is 0.5 i know the range will go from base/2 to base*2
if amount is 0, no modulation will occurs
if amount is > 1 there will be negative cutoff frequency

1 Like