AHDSR to modulate filter cutoff in Scriptnode
-
@Lindon ok, so I put a midi container to gate my mod container and the signal path correctly flow through the container and the ADSR visually react...but inside the mod container I can't target the CV out to the freq filter...
-
Ok, disconnecting my Cutoff parameter knob now I can target the freq with the CV output...but now I don't know how can I control the freq with my knob AND control the amount of envelope...
-
@arcy you need your envelope to modulate your cutoff. so the envelope is a scaler in this case. the envelope already outputs 0-1. you just need to multiply your cutoff with that value.
in a separate modchain, add a math.add value and plug your Cutoff parameter into it. now add a math.mul node and plug your CV into that. now add a peak node and plug that into the frequency of your filter.
-
@aaronventure thanks! now my Env knob correctly set the amount of modulation to the cutoff. Now how can I use my Cutoff knob to open the filter freq?
-
@arcy your cutoff knob sets the math.add. (remember, this needs its own separate modchain node because it doesn't want any other signal there). your env sets the math.mul to apply scaling to the cutoff. your peak node sends the resultant value to whatever you plug in into, in this case the freq knob.
if you now move the cutoff parameter, your freq should also be adjusting
-
@aaronventure ooooook now it works, I confused the previous message. Thanks!!
-
-
@aaronventure sorry, could you keep an eye?
It seems that all works but my env knob can't go to the multiplier because it's already plugged with CV...
-
-
@arcy it's a math problem.
you need to decide how will your envelope behave. will the env button add the envelope to the current cutoff value, or will it apply the envelope to the current cutoff value?
Then write this out as a math problem.
If you want the envelope to apply to your current cutoff value and want to control the amplitude of the envelope itself, the equation is
cutoff - (cutoff - cutoff * envelope) * amount = frequency
.If you want the envelope to act on top of the cutoff value, it's a bit more problematic because you have to watch for limits and scale it appropriately.
Now you just recreate this in scriptnode.
-
@aaronventure
So, in an example:CUTOFF knob turn the filter freq to 400hz.
if ENV is 0, the freq behave normally without ADSR. The more I turn clockwise my ENV knob the more the modulation react FROM the current frequency (400 in our case).It's the normal behaviour of any synth filter.
-
@arcy then you first need to decide the amount that the env knob is affecting. Is it simply multiplying the frequency and that's the max that the envelope can reach? Is it working off of a percentage of the delta between fmax and fcurrent? is it working off a percentage of the entire frequency range?
if it's working off the entire frequency range, your equation is
current + 20000*env*amt
with a clipper at the end. you'll likely have to fiddle with tables or skew values in your knobs to get the right curve because of the logarithmic response for filter frequency. -
Hi guys, I solved the problem with the pma node. I hope this can be useful for all:
@aaronventure from a math pov your advice is super! I'll try to apply it with a custom Faust module.
Bye!
-
-
@arcy hey man, thx for posting your solution. Exactly what i was looking for. Great, thx!!!