Hi all!
On example below I try to use SinOsc for very basic amplitude modulation,
but I can not control amount of modulation in a usefull way.
If I set lfoGain to 0, than lfo will out 0 and I’ll get no sound as result.
I feel that there is a very basic math behind it but I can not find an answer.
q = {
var sig = SinOsc.ar(220);
var lfoFreq = 2;
var lfoGain = 1;
var lfo = SinOsc.ar(lfoFreq).range(0, lfoGain);
Out.ar(0, sig * lfo);
}.play;
q.free;
So how can I implement signal modulato n with controllable depth?
Your variant a bit closer but it have some strange effects.
Looks like lfo overdrive sig, so sig amplitude should be divided by some coeficient.
And also if I turn \lfoGain to zero it will also multiply sig by zero and I’ve got a silence
I think what you’re looking for is for when the gain is zero, the original signal is passed unaltered, all the way up through when the gain is 1, the signal amp oscillates between x0 and x2, yes?
if so, this will do what you’re looking for:
var lfo = SinOsc.ar(lfoFreq) * lfoGain + 1;
Multiply by lfoGain to increase or decrease by the gain amount, and then add 1 so that when the gain is zero, the lfo is just 1.
More suitable. But anyway result will from 0 to 2 and it will overdrive carrier signal.
I decided to clip it var lfo = (SinOsc.ar(lfoFreq) * lfoGain + 1).clip(0.0, 1.0);
But now, when lfo moves only with half of values looks like I need to compensate lfoFreq somehow;
At least it solve overdrive problem.