View Single Post
Old 10-17-2019, 01:42 AM   #63
solarfall
Human being with feelings
 
Join Date: Sep 2013
Posts: 44
Default

Hello guys,
i did some major corrections and here's a new version. I've reworked the filter which basically is a loPass different for every channel and from left to right.

This plugins works best at 0 VU which corresponds to -18dB. It's supposed to add subtle harmonic distortion so don't feed it with high signal or it will distort badly. I think aliasing should be a minor problem since distiortion is so subtle.

Let me know what you think.

Enjoy!

Code:
desc:AnalogSum

slider1:0<0,2,1{1,2,3}>Saturation Type

@init

a0L = 0.4 + ((rand()/5)-0.05);
a1L = 0.9 + ((rand()/5)-0.05);
a0R = 0.4 + ((rand()/5)-0.05);
a1R = 0.9 + ((rand()/5)-0.05);
dist = 1.6;




function LoPass()
(
  xnL = spl0;
  
  ynL = (a0L * xnL) + (a1L * xn_1L);
  
  xn_1L = xnL;
    
  spl0=ynL;
  
  xnR = spl1;
  
  ynR =  (a0R * xnR) + (a1R * xn_1R);
  
  xn_1R = xnR;
  
  spl1=ynR;
);

function analog_stereo()
(
  m = 0.5*(spl0+spl1);
  s = 0.6*(spl1-spl0);
  spl1 = m + s;
  spl0 = m - s;
);

function add_noise()
(
  spl0 += 0.000005*((rand(1)*2)-1);
  spl1 += 0.000005*((rand(1)*2)-1);
  spl0 += rand(1)/100000*sin(2*$pi*51*t);
  spl1 += rand(1)/100000*sin(2*$pi*51*t);
  spl0 += rand(1)/100000*sin(2*$pi*150*t);
  spl1 += rand(1)/100000*sin(2*$pi*150*t);
  t+=1/srate;
);

function curve1()
(
  spl0 = ((($e^(dist*spl0))-($e^(-dist*spl0)))/(($e^(dist*spl0))+($e^(-dist*spl0))))-(spl0/sqrt(1+(dist*(spl0^2))))+(spl0/dist);
  spl1 = ((($e^(dist*spl1))-($e^(-dist*spl1)))/(($e^(dist*spl1))+($e^(-dist*spl1))))-(spl1/sqrt(1+(dist*(spl1^2))))+(spl1/dist);
  spl0 *= 0.7;
  spl1 *= 0.7;

);

function curve2()
(
  spl0 = sin(tan(spl0))*cos(atan(dist*spl0))*dist*0.9;
  spl1 = sin(tan(spl1))*cos(atan(dist*spl1))*dist*0.9;
  spl0 *= 0.6;
  spl1 *= 0.6;
);

function curve3()
(
  spl0 = (dist*spl0)/(1+abs(2*dist*spl0))*((2+dist)/dist);
  spl1 = (dist*spl1)/(1+abs(2*dist*spl1))*((2+dist)/dist);
  spl0 *= 0.25;
  spl1 *= 0.25;
);



function Saturate ()
(
 
  reg00 == 0 ? curve1();
  reg00 == 1 ? curve2();
  reg00 == 2 ? curve3();

);

@slider
  
  reg00 = slider1; 
  
  
@block

@sample

  add_noise();
  LoPass();
  Saturate();
  analog_stereo();
  
  slider1=reg00;
solarfall is offline   Reply With Quote