Gain Question
-
Hey!
I'm working on a scriptnode fx and was wondering about gain! I have this gain node which can drive up the gain amount, I want to add another gain node after that which counter acts the change.. Basically, I'm trying to make it so that wherever the main "Gain" knob is, the gain level doesn't change. I think to do this, the second is always the opposite gain than the first. Like when the first gain node is at 6 dB, the second should be at -6 dB to make 0 dB change, right? However, in my snippet, this doesnt happen for all possible values on the main "Gain" knob. Any thoughts?
HiseSnippet 1783.3oc6Y0saaTDEdVmroD2xOEZEHtZEhKbjJQ1gR+gJTcRbbaD0IVYCgxEPYxtGaOjYmY0tiSpA064Ntl63Qfa4t9HfDu.7HvaP4Lyr16tIVgDSaAjHUpJy4mY9l4bNeyY1zMQF.ooxDhyh6NJFHNWx0ejPMX8ATlfrYKhyq41glpfDOqn0FESSSgPhiyb2SKvYw4Ile9i6tFkSEAPtHBYOIK.d.Khoxk1s4mx371zPXWVTAqudyMCjh0kb4PDOy4VmDSCNf1G1hpMqhKwYgMBYJYhuhpfTzl0jgi7GHORXseOVJaeNnGzf3iSjULY8ALdX2w60TBwwsa9NeN6N+JtcXgrIxyOAdCiBubOJdF3T4zfTiyAjbJ.o4sP5xt9AIrXUtFMdtn6lBLfzihG0Egh0VRkCcbWWhVHTKGQO.ZmfCl3QsaTu907v+ao6TsZBz2Sgw.uOwaCQel.VNHAv8gNtjr89eCDnposSayxoJZhxnoVCq6VwfU35TNeeLdUq2PQfhIE0Vp52UcQDIoRNrbbBSnpksJ8AUKHfsOvSaKSzoQsoA3gXA81jtt.8fG.GB7Z0WZIbIexR2Y7z6IEaIUv1YqS0mT063p50ap5zGNIRNG2HSSscKdJNVSLLZeH4ZdGR4CgIFhQsxoBKb1REBrwpBFJEaJXpsigrwsk7PcHV+6mLwgjErwe6y1rEUQ04RYxP6hgDESCGmVvgXwnMyZQ2VP5AJYrw1nXoPOCNWRkUJXykZykTESzeWFBaFhfW2snnFjGWrVeT9fup4QrP0.rNyoUEBY.v5OPoGEliWKPp59ovn8kzjPx98GW6u3BgggOSOQLEDkK8Y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JpqEnFJJatUTIqzaO7ooQEsq4XgEr7UZ1kJJMY33RyTGVgGI862cCAEa5vGvcS31oA3lklmCYmfgXG3l2nznni4hWon36issiwkfRsiNW4Nel+r04S4NyKX+TZTbgWTe+j4Oa8t9W7j3+8+ZjRsZu3XL5yzsHug3PfikoFL9ltYOhbrzx0YcjB43t8xy.1AvVU62GRJh8otgVUovWglK4JM2A3.MsDK1Cvl6nIcL2mNSmEm+O80TiWuiqEtdZxAu+NwsWpoYm5KJm6L8hxm63c1ec4K4JTj+7+NQ521E4zWwyDt89mOd+x3gquLViHZPh7QA126qILdEiDbeKL+oAVzsidrWCxg1Fvb0uXkDgW67nf.cN8GfmOS2mUlAe9vYvmqOC97QyfO2XF74lyfO25T8Qeie1SRz4+nftaX5D0ww1AjoTf7m.erDBvA
Thanks!
-
The skew factor is one-sided seemingly, i.e. I don't think the function is symmetrical.
Right click on each knob (including the parameter knob that controls the others) and set the skew factor to 1. You should now get linear controls. You can also right click on the graph and "reset skew". You can see that the graph is linear now.
If you need them to have a curved output, I think you'll have to write it yourself (in the control callback of your GUI control when you connect it to the parameter in scriptnode, after obtaining the network reference), or just set the desired midpoint if you're gonna use the slider widget.
But the no-skew setup in scriptnode allows for 1:1 output on both the normal and the inverted gain knobs.
-
@aaronventure ahh, do you know what really is the skew value or what function it uses? I'm trying to have them be a curved output, the ui callback method seems ok (take value of knob on ui and set that value to the scriptnode knob?), but could you explain more of the slider pack method as well? Thanks!
-
@Casmat it's a factor that affects the overall curve.
If your gain knobs in the network are linear, then they correctly output inverted gain values for the same parameter input.
You can map a GUI control to that parameter input either in the object properties or via the script, in the callback. You take a reference to the network, then you set the value of the parameter which should be available in autocomplete after you type in the reference. That's the basic stuff that you can find in the docs.
If your widget is a slider, then it can take the "middlePosition" property, which sets the value that the control will output at the middle. This is how you set the skewing for the GUI controls using the slider widget. You just then take that value and set it to the network parameter. Since the network parameter is now linear, its behavior will be "curved".
Let's say your range is 0-10, and you set the midpoint on the GUI widget to 7.5. When you set your GUI widget slider to half, it will output 7.5, but the linked network parameter will be dialed 75% of the way.
This is a non-issue because these parameters are hidden from the user anyway.
If you're a bit masochistic like me and want to use a panel, you'll have to write your own curving formula to output the desired value, as the panel widget (at the time of writing this) does not have the "middlePosition" property.
-
@aaronventure thanks for the explanation! Seems like the slider route seems perfect for my use case, however that panel route sure does look like fun!