%% expdist.m 
% [DAFXbook, 2nd ed., Chapter 4]

function y = expdist(x, gain); 

% Author: Bendiksen, Dutilleus, Zolzer, Dempwolf
% A soft-curve distortion simulation based on an exponential function. 

% x = input
% gain = amount of distortion, >0

mix = 100; 

q=x*gain; %/max(abs(x));
z=sign(q).*(1-exp(-abs(q))); 
y=mix*z+(1-mix)*x; 
y=y*max(abs(x))/max(abs(y));
end 


