home *** CD-ROM | disk | FTP | other *** search
/ PC World 2008 February / PCWorld_2008-02_cd.bin / audio-video / reaper / reaper2028-install.exe / Effects / schwa / soft_clipper < prev   
Text File  |  2007-12-03  |  986b  |  43 lines

  1. desc:Soft Clipper, for a nice final level boost.
  2.  
  3. // Modeled after the soft-clipping stage in a popular 
  4. // "tube mastering" plug-in.  This is really just
  5. // a low threshold brick wall limiter that is all knee.
  6.  
  7. slider1:0<0,9,0.1>boost dB
  8. slider2:0<-3,1,0.1>output brick wall dB
  9.  
  10. @init
  11.  
  12. amp_dB = 8.6562;
  13. baseline_threshold_dB = -9.0;
  14. a = 1.017;
  15. b = -0.025;
  16.  
  17. @slider
  18.  
  19. boost_dB = slider1;
  20. limit_dB = slider2;
  21. threshold_dB = baseline_threshold_dB + limit_dB;
  22.  
  23. @sample
  24.  
  25. dB0 = amp_dB * log(abs(spl0)) + boost_dB;
  26. dB1 = amp_dB * log(abs(spl1)) + boost_dB;
  27.  
  28. (dB0 > threshold_dB) ? (
  29.   over_dB = dB0 - threshold_dB;
  30.   over_dB = a * over_dB + b * over_dB * over_dB;
  31.   dB0 = min(threshold_dB + over_dB, limit_dB);
  32. );
  33.  
  34. (dB1 > threshold_dB) ? (
  35.   over_dB = dB1 - threshold_dB;
  36.   over_dB = a * over_dB + b * over_dB * over_dB;
  37.   dB1 = min(threshold_dB + over_dB, limit_dB);
  38. );
  39.  
  40. spl0 = exp(dB0 / amp_dB) * sign(spl0);
  41. spl1 = exp(dB1 / amp_dB) * sign(spl1);
  42.  
  43.