Hello, friends -
I have a widget connected to the output gain of a compressor. The range of the gain parameter is -24dB to +24dB. If I use GetWidgetValue, then of course I get a value between 0.0 and 1.0, and currently I’m converting that to a dB value (by multiplying by 48 and subtracting 24). This seems like an ugly hack.
That example is particularly simple because it’s a linear relationship, but here’s another one: I have a widget connected to a volume parameter of a mixer block or a gain control block. The dB value of the volume parameter ranges from negative infinity to +6dB. I can certainly figure out how to calculate the dB gain from the widget value, but that seems like an even uglier hack.
Furthermore, if I’m using a scaling curve other than the default, I’ll have to work that into my formula too, and if I change the scaling curve I’ll have to remember to change the formula in my code.
So is there a way of just getting the dB value from the underlying plugin directly rather than having to recalculate it?
Thanks in advance!
This is maybe tricker than I thought… I came up with this formula:
dBValue = 20 * Log(2) + 40 * Log(widgetValue)
However, this is actually not precisely correct; it’s off by a small fraction of a dB at very quiet dB levels, which is irrelevant in practice, but does illustrate my problem.
I assume you’re talking about doing this using GP Script.
So the answer depends totally on what the plugin manufacturer exposes.
There are two functions in GP Script that retrieve info from a plugin GetParameter and GetParameterText and they do exactly the same thing that widgets are doing.
Understand that the reason that widgets go from 0.0 to 1.0 is because the underlying value of plugin parameters go from 0.0 to 1.0 and that’s what you get if you use the GetParameter function.
The default caption that you see on a widget is the same as the GetParameterText function and that function asks the plugin to give you back a value as a string. However, it’s completely up to the plugin to determine the contents of that string and if the plugin doesn’t return a string with a dB value (which you could then parse to extract the numeric part), then you’re unfortunately out of luck.
Ahh… in that case, what I’m already doing is probably the best way. I wanted to get the parameter value (in dB) from the widget, in a plugin-independent fashion: in other words, I thought I wanted to get the parameter value rather than the widget value. But I understand from your response that in fact I’m already getting the parameter value. So I’m good.
(What I’m attempting to do is to get the dB value from a widget connected the volume of a mixer block, add it to the dB value from a widget connected to the compressor plugin’s output gain, write that sum back to one of the widgets and write 0dB back to the other widget. In other words, I want to add the two widget values together in dB. Seems like I’ll have to do it exactly as I already am doing it: hard-code both the linear mapping corresponding to this particular compressor plugin and the logarithmic mapping corresponding to the GP mixer block in my GPScript code. I wanted to avoid hard-coding those transformations but I guess that was misguided.)