Created
January 4, 2020 15:51
-
-
Save jpcima/15b052e43f7c1d57bc0264d3e6b3650a to your computer and use it in GitHub Desktop.
Asymmetric soft clipper with level parameter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # CC0-1.0 or MIT | |
| # asymmetric soft clipping waveshaper | |
| # k: the curve control parameter (0 excl. to 1) | |
| cubic(x)=(x*x*x/3) | |
| lm(k)=-sqrt(k*k*k)/(k*k*k) # the local minimum | |
| kubic(k,x)=x-cubic(k*x) | |
| max(a,b)=(a>b)?a:b | |
| nl(k,x)=(x>0)?x:kubic(k,max(x,lm(k))) | |
| z=2./3.; | |
| nl2(k,x)=nl(k,x-z)+z | |
| set xrange [-1:+1] | |
| plot nl2(0.2,x) t "2", nl2(0.3,x) t "3", nl2(0.4,x) t "4", nl2(0.5,x) t "5", nl2(0.6,x) t "6", nl2(0.7,x) t "7", nl2(0.8,x) t "8", nl2(0.9,x) t "9", nl2(1.0,x) t "10" |
Author
jpcima
commented
Jan 4, 2020

Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment