about an equation?
-
hello everyone
with my Knob (x value), I need to get the below corresponding y values. It is not linear :/ How can I implement it?
x
vsy
0.0
-10.0
1.0
-2.9
2.0
-1.15
10.0
1.04
100
2.01
-
@Steve-Mohican
If you only need those values the simplest way would be to use two arrays
inline function onKnob1Control(component, value) { local input = [0.0, 1.0, 2.0, 10.0, 100.0]; local output = [-10, 2.9, -1.15, 1.04, 2.01]; if (input.contains(value)) Console.print(output[input.indexOf(value)]); }; Content.getComponent("Knob1").setControlCallback(onKnob1Control);
-
@Steve-Mohican
If you want the values' transition each other, yes you definitely need a non linear equation for this situation. You can get very close values with a rational equation which is essentially this:
(a+b*x)/(1 + c*x + d*x^2)
Here you go
HiseSnippet 992.3ocsV0saaaCElxIJaVasXcnO.BE6B60FGIaK+CJJpWbbJL5RpQcpQ2UELRTwDlhTShpstE8t87r2o8Fr2fsCojiUVLbaMvDfAz4W9c9z4bnmjH7IoohDjQ0KVFSPFeu4zkb47gywTNZ7IHi6ZdFNURRryUc7xXbZJI.YXr2yTJLptOR+72O8XLCy8IqUgPyDTexuRinx0ZmL34TF6Tb.4BZTIuaOXrufOTvDY.d1yzAEi8WfuhbNV4VESjwAiBnRQxTIVRRAeNVDrb5bw6349OilRujQTBtnoPhxUiFNmxBlrpVSQHi8mrtx2Kuxuu4Yz.505Wy.+f1f85HJyAFU1Fjb+JfjQIHseNjtm4T+DZrbsEEd9Nywb3CRHFn5xPI2WTkiqXNT.dvkMhvKHml.BWGQsVNNOxtoiS8GaYYA7cpz9s3D6myEW5Z+D6UQdEQNTDEK3fPsGns9.UHTNixI1gYbeIUvsEbsMUXIBVM+Uw7HHqrLRcqOZU8nireIV4MlYO52yzuZaUkI7AE9BRX3L3kmXWq1gtMbTOM852qe21caM5gNt0seHXpYiNc560saSOmtdc60p9Ome.0sOxtlq1E2Fdsb5zrcyNc6302o2JWzFOrYCOudM621qe2NNs8bGcnCjjyvx4MhEuql1UfYpWu9iAvYUEJoTAizHNgBTvJXp3fOA+1JO0HUoUyH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