Gain Reduction Meter on a Faust compressor
-
A global cable can allow you to get the modulation data onto the Ui. From there a panel can use the global cable to draw whatever you want, or set the image if you are using a filmstrip animation.
There is a global cable node in scriptnode which will send it out into the global cable network.
You also need to declare the cable on the Ui.
It's been a while since I've done it. -
@Mighty23 when you make a graph, it creates an output cable like that? what does the faust code for that look like?
-
@aaronventure
the full code is in the snippet in the main post. inside Script FX1 there is the faust node.// Add gain reduction meters to the UI gainReductionLeft = gain_reduction(l) : vbargraph("Gain Reduction Left", -60, 0); // Left channel gainReductionRight = gain_reduction(r) : vbargraph("Gain Reduction Right", -60, 0); // Right channel };
-
@Mighty23
Hello. Were you able to solve the problem? What compressor are you using? -
@aaronventure the vbargraph UI element in Faust translates to a mod output.
-
import("stdfaust.lib"); /* Controls */ comp_group(x) = hgroup("1-compression", x); env_group(x) = vgroup("2-envelop", x); gain_group(x) = vgroup("3-gain", x); link_group(x) = vgroup("4-channel linking", x); // Controls ratio = comp_group(nentry("ratio", 2, 1, 20, 0.1)); threshold = comp_group(nentry("threshold", -20, -96, 10, 0.1)); knee = comp_group(nentry("knee", 3, 0, 20, 0.1)); attack = env_group(hslider("attack [unit:ms]", 2, 0, 1000, 0.1) : /(1000)) : max(1/ma.SR); release = env_group(hslider("release [unit:ms]", 500, 0, 10000, 1) : /(1000)) : max(1/ma.SR); makeup_gain = gain_group(hslider("makeup gain", 0, -96, 96, 0.1)); // Control for channel linking - stereo vs dual mono. channel_link = link_group(hslider("channel link", 100, 0, 100, 1) : /(100)); // Envelope detector t = 0.1; g = exp(-1/(ma.SR*t)); env = abs : *(1-g) : + ~ *(g); // Compression function compress(env) = level*(1-r)/r with { level = env : h ~ _ : ba.linear2db : (_-threshold+knee) : max(0) with { h(x,y) = f*x+(1-f)*y with { f = (x<y)*ga+(x>=y)*gr; }; ga = exp(-1/(ma.SR*attack)); gr = exp(-1/(ma.SR*release)); }; p = level/(knee+0.001) : max(0) : min(1); r = 1-p+p*ratio; }; // Gain computer for a single channel gain_computer(x) = env(x) : compress : gain : +(makeup_gain) : ba.db2linear with { gain(x) = attach(x, x : gain_group(hbargraph("gain", -96, 0))); }; // Gain reduction calculation (in dB) gain_reduction(env) = env : ba.linear2db : (_ - compress(env)) : min(0); // Main process process(l,r) = (gl*l, gr*r) with { g_left = gain_computer(l); g_right = gain_computer(r); g_linked = max(g_left, g_right); gl = g_left*(1-channel_link) + g_linked*channel_link; gr = g_right*(1-channel_link) + g_linked*channel_link; gainReductionLeft = gain_reduction(l) : hbargraph("[5]Gain Reduction Left[style:numerical]", -60, 0); gainReductionRight = gain_reduction(r) : hbargraph("[6]Gain Reduction Right[style:numerical]", -60, 0); };
@udalilprofile said in Gain Reduction Meter on a Faust compressor:
Hello. Were you able to solve the problem? What compressor are you using?
I'm still trying, as soon as I can get a decent version I'll post a snippet.
-
-
@Mighty23 thnx)
-
@Christoph-Hart How exactly would I access the 'mod output' of a vbargraph UI element?
My goal is to simply put a meter from my faust code on the interface. -
@trummerschlunk Right now you can't because the mod output goes away once you compile the node and you can only use a compiled Faust node within ScriptNode.
https://github.com/christophhart/HISE/issues/619
But to answer your question, you would just pass your GR through vbargraph.
Let's say you're calculating it separately so
gainReduction = gain reduction math here : vbargraph("GainReduction",0,1);
https://faustdoc.grame.fr/manual/syntax/#vbargraph-primitive
-
@aaronventure so I understand correctly: no workaround?
-
@trummerschlunk depends on what you're metering. If it's just the gain reduction, you can have a peak node before the faust node and another right after, subtract these to get the difference (do it in the modchain so that it doesn't affect your audio signal) and there's your gain reduction.
If you're metering something else, you can do one of two things:
- run a multichannel scriptnode (4 channels for example) with a 4 channel faust effect and simply output whatever you're metering to the other two channels, get them specifically with a multi node (to separate the channels) and use that in your interface
- create another version of your faust effect where you're outputting whatever your metering and just connect it to the same parameters as your main faust effect (keep in mind that, since you're gonna be doing this in modchain, you only need one channel out of faust as modchain is a single channel node
-
@aaronventure ok, thanks...
For me it's not about gain reduction, so I hope the first option for 'metering something else' will work. I have a lot of meters though... 20 to be precise... -
@trummerschlunk see my answer here: https://faustdoc.grame.fr/manual/syntax/#attach-primitive
-
Thanks, @sletz, I am aware of the
attach
primitive. The problem is that no metering signals are available in HISE when the dsp network is compiled.