Knob value to different ranges for different fx

  • Hello

    Is there a way to transform the knob value inside the inline function, so it only has a specific range. I want to have a knob that goes to different fx, but controls them with different ranges. I don't want to change the overall range of the knob... I hope that makes sense... 🤨

    I guess I could add to the min value and subtract from the max value etc... but that seems rather unwieldy. I am sure there's a simpler way to do it!

    Thanks! Appreciate the help with the newbie question!


    I am sure what I wrote here is not really it but it hopefully shows what I am trying to do...

    const var Knob1 = Content.getComponent("Knob1");
    inline function onKnob1Control(component, value)
    	Degrade1.setAttribute(Degrade1.NonLin, Math.range(value, 0.2, 0.5));

  • inline function remapRange(value, oldMin, oldMax, newMin, newMax)
            return (((value - oldMin) * (newMax - newMin)) / (oldMax - oldMin)) + newMin;

  • @d-healey Thx David! Food for thought...

  • @vewilya The general mapping formula is simply derived from a cross-multiplication like so targetMin + ((targetMax - targetMin) x value)
    You can also have use of Engine.getDecibelsForGainFactor(double gainFactor) for gain stuff

Log in to reply