You can test the following gig file:
rescaled_curve_transpose.gig (5.9 KB)
Which integrates this script:
//$<AutoDeclare>
// DO NOT EDIT THIS SECTION MANUALLY
Var
PITCH_KNOB : Widget
RESCALED_KNOB : Widget
//$</AutoDeclare>
function rescale(value : double) Returns double
Var
rescaled_value : double;
rescaled_value = 0;
//originally a widget value ranges from 0.0 to 1.1 but the curve definition ranges from 0 to 127
value = value * 127.0;
Select
value < 47 Do rescaled_value = Scale(value, 0, 47, -24, 0);
value > 83 Do rescaled_value = Scale(value, 83, 127, 0, 24);
End
// The MIDI in block plugin transpose ranges from -48 to 48 but its value ranges from 0 to 1
rescaled_value = Scale(rescaled_value, -48, 48, 0, 1);
result = rescaled_value;
End
// Called when a widget value has changed
On WidgetValueChanged(newValue : double) from PITCH_KNOB
RESCALED_KNOB.SetWidgetValue(rescale(newValue));
End
Such that you can check what happens, the first knob is controlled by your MIDI controller, the second one is modified by your rescale curve and controls the transpose parameter of an assigned MIDI in block plugin. This one way of doing it, there are other possibilities…
