Rms type or Cosine type Crossfade Curves
-
here is a small code, i have a wet and and dry module in HISE, using simple gain, and there is a knob on the UI names wetdryknob, now this script works fine switching between wet and dry from -100 to 0db, but at 50% both the gain are at -50db, the curve is linear, iam not goo at maths, but the gain output should be constant and gain matched. how can i achieve it.
const var wetdryknob = Content.getComponent("wetdryknob"); const var FX1 = Synth.getEffect("WET"); const var FX2 = Synth.getEffect("DRY"); inline function onMasterKnobControl(component, value) { // Normalize value to 0–1 range local normValue = value / 127.0; // Map WET: 0 → -100dB, 1 → +18dB local wetGain = normValue * 127 - 0; // Map DRY: 0 → +18dB, 1 → -100dB (inverted) local dryGain = (1 - wetGain) - normValue * 0 - 101; FX1.setAttribute(FX1.Gain, wetGain); FX2.setAttribute(FX2.Gain, dryGain); } Content.getComponent("wetdryknob").setControlCallback(onMasterKnobControl); -
@Jeetender use an RMS calculation.