Modulator Intensity/Depth in FAUST, best practice?
-
This happens a lot and I always get this wrong.
What is the best way to modulate a signal with e.g. a velocity dependent on a velocity-modulator intensity?
signal is obviously -1 to +1 or any value
modulator can be 0-1 (e.g. a velocity) or -1 to +1 (e.g. an lfo) (so I guess it's two seperate formulas)
and the intensity is 0-1 where with 0 the signal remains unchanged and with 1 it is modulated by the velocity.what are the most simple formulas for this?
I reckon many people often need this and can't wrap their head around it.I have figured this out many times before but whenever I look at it or try to reuse it on another occasion it somehow turns to mush by just looking at it... and a dry/wet node can't be the most optimal solution
-
I figured out the following so far
velocity = 1-depth*(1-gain); // for modulation from 0-1 process = osc(freq) * velocity <: _,_;
this gives me a velocity according to the depth from gain (the midi velocity automatically captured in faust). So if depth is 1 there is full velocity modulation, if depth is 0 the notes are always maximum volume (velocity = 1)
similarly with signals from -1 to 1 this should work
modulation = 1-depth*(signal*0.5+0.5); // for modulation from -1 to +1 process = osc(freq) * modulation <: _,_;
someone please correct me if I'm wrong. This still looks like mush to me but it seems to work and I can't see an easier way to do it.
-
@Morphoice the first
1*
part is just useless right ? (also Faust will optimise this itself of course) -
@sletz fixed thanks