ModScripter Scripts

If you want to combine movement of several parameters but you want not all the movement to be linear this script might be the solution. This script expects you to use the ModScripter as an “insert”, preferably between the “Macro” modulator and the target.

// This script will alter the output in five different ways:
// 1: will change the direction of the input at the KeyPoint value
// 2: will change a linear input into a curved output
// 3: as 2 but upside down inverted
// 4: will change a linear input into parabel, open side down
// 5: similiar to 4 but with a bent parabel
// Script provided by m.c and Johnny Moneto

getDescription = function () {
    return "Fold, Bend, and Curve";
}

lineTypes=[
    {name:"Linear", value: 0},
    {name:"Curve", value: 1},
    {name:"InvCurve", value: 2},
    {name:"InvPara", value: 3},
    {name:"BendPara", value: 4}
];

lineType=0;
keypoint=0;
outputValue=0;

processModulation = function (inputValue, numSamples) {
	if (lineType==0)
        if (inputValue<keypoint){
            return inputValue;
        }
        else {
            outputValue = keypoint-(inputValue-keypoint);
            return outputValue
        }
	else if (lineType==1)
		return Math.pow(inputValue, 0.05+(keypoint*5));
	else if (lineType==2)
		return 1-inputValue*inputValue;
	else if (lineType==3)
		return (inputValue*(1-inputValue))*(4*keypoint);
    else
        return (inputValue*Math.pow(1-inputValue, keypoint));
}

onParamChange = function(paramIndex, paramValue) {
    if(paramIndex==1){
        lineType=normalizedToSteps(paramValue,lineTypes.length-1,0);
    }
    if(paramIndex==2){
        keypoint = paramValue;
    }
}

getParamTitle=function(paramIndex){
    if(paramIndex==1){
        return "Line Type";
    }
    if(paramIndex==2){
        return "KeyPoint";
    }
}

paramValueToString=function(paramIndex,paramValue){
    if(paramIndex==1)
    {
        index=normalizedToSteps(paramValue,lineTypes.length-1,0);
        return lineTypes[index].name;
    }
}
 
stringToParamValue=function(paramIndex,string){
    if(paramIndex==1)
    {
        for(i=0;i<lineTypes.length;i++)
        {
            if(lineTypes[i].name==string)
                return stepsToNormalized(i,lineTypes.length-1,0);
        }
    }
}