XY Pad Gain Scaling...
-
Morning all hope you are all enjoying the holidays still.
I've got an XY Pad in a project that in itself is working nicely doing what it should and has a knob assigned to X axis and one to Y axis as you would expect, I'm wanting to control the gain on 4 simple gains 2 on the X 2 on the Y which again I've got working as it should, I'm just not sure to the maths for the values currently I've got it set to this:
inline function onxypadControl(component, value) { local x = component.data.x; local y = component.data.y; gains1[0].setAttribute(gains1[0].GainValue, 36 * x); gains1[1].setAttribute(gains1[1].GainValue, 36 - 36 * y); gains2[0].setAttribute(gains2[0].GainValue, 36 * x); gains2[1].setAttribute(gains2[1].GainValue, 36 - 36 * y); knbxy[0].setValue(x); knbxy[1].setValue(y); component.repaint(); }Which works to set the gain between 0 and 36. Now 36db is going to be way too loud for whats going on here so yes I could reduce that but also gain running right down to -100 whats the easiest way for me be able to include some of that in the range essentially looking at -30 to 20 or some such or in other words almost barely noticeable to packs some punch if you want.
-
J JamesC has marked this topic as solved
-
@JamesC So for those interested this is how I solved it in the end with a bit of AI help:
inline function onxypadControl(component, value) { local x = component.data.x; local y = component.data.y; local gainX = -40 + (60 * x); local gainY = -40 + (60 * (1 - y)); gains1[0].setAttribute(gains1[0].GainValue, gainX); gains1[1].setAttribute(gains1[1].GainValue, gainY); gains2[0].setAttribute(gains2[0].GainValue, gainX); gains2[1].setAttribute(gains2[1].GainValue, gainY); knbxy[0].setValue(x); knbxy[1].setValue(y); component.repaint(); } -
@JamesC yeah thats one way - but for us this algo approach wasnt quite good enough so we added a simple array of gain(dB) values that the xy pad reads to get the correct gain for its current position - and thus allowed us to have a little "bump" in the middle