View Single Post
Old 06-16-2019, 11:19 PM   #488
danerius
Human being with feelings
 
Join Date: Oct 2018
Posts: 173
Default Help explaining code

Hi. Im having trouble understanding this bit of code. Its from Losers Waveshaping Distortion.

Mostly the second line "hdistr =....". How does the "100,.999" bit work? I get that It gives a value for "foo" to be calculated and then used in the formula. How would I enter these values in a regular calculator? Slider range is 0-100.

/thx

@slider
hdistr = min(slider1/100,.999);
foo = 2*hdistr/(1-hdistr);

@sample
spl0 = min(max(spl0,-1),1);
spl1 = min(max(spl1,-1),1);

spl0 = (1+foo)*spl0/(1+foo*abs(spl0));
spl1 = (1+foo)*spl1/(1+foo*abs(spl1));
danerius is offline   Reply With Quote