home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 January / PCWorld_2007-01_cd.bin / temacd / reaper / reaper147-install.exe / Effects / SStillwell / realoud_lpf < prev    next >
Encoding:
Text File  |  2006-08-14  |  3.0 KB  |  99 lines

  1. // Copyright 2006, Thomas Scott Stillwell
  2. // All rights reserved.
  3. //
  4. //Redistribution and use in source and binary forms, with or without modification, are permitted 
  5. //provided that the following conditions are met:
  6. //
  7. //Redistributions of source code must retain the above copyright notice, this list of conditions 
  8. //and the following disclaimer. 
  9. //
  10. //Redistributions in binary form must reproduce the above copyright notice, this list of conditions 
  11. //and the following disclaimer in the documentation and/or other materials provided with the distribution. 
  12.  
  13.  
  14. //
  15. //The name of Thomas Scott Stillwell may not be used to endorse or 
  16. //promote products derived from this software without specific prior written permission. 
  17.  
  18.  
  19. //
  20.  
  21.  
  22. //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 
  23. //IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 
  24. //FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
  25. //BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
  26. //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
  27. //PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
  28. //STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 
  29. //THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. desc:realoud - makes it louder, duh...
  31.  
  32. slider1:0<0,100,0.1>mix%
  33. slider3:22000<1,22000>lpf frequency (Hz)
  34. slider4:0.2<0,1>size(1/Q) (0=sharp/resonant, 1=dull)
  35. slider5:1<0,1,1>filter pre/post drive (0=pre)
  36.  
  37. @init
  38.  
  39.   pi = 3.1415926535;
  40.   halfpi = pi / 2;
  41.  
  42. @slider
  43.  
  44.   mix=slider1 / 100;
  45.   drive=slider2 / 100;
  46.   freq=slider3;
  47.   size=slider4;
  48.   prepost=slider5;
  49.  
  50.   damp=0.01+size*20;
  51.   c = 1/tan($pi*freq/srate);
  52.   fk = 1 / (1 + c*(c+damp));
  53.   fa1 = 2 * (1 - c*c) * fk;
  54.   fa0 = (1 + c*(c-damp)) * fk;
  55.   oldamp=damp;
  56.  
  57.   mix1 = 1 - mix;
  58.  
  59. @sample
  60.  
  61.  
  62.   dry0 = spl0;
  63.   dry1 = spl1;
  64.  
  65.   prepost>0.5 ? (
  66.     spl0=min(max(spl0,-1),1);
  67.     spl1=min(max(spl1,-1),1);
  68.  
  69.     wet0 = sin(dry0 * halfpi);
  70.     wet1 = sin(dry1 * halfpi);
  71.  
  72.     fd0l = (fk*wet0) - (fa1*fd1l) - (fa0*fd2l);
  73.     fd0r = (fk*wet1) - (fa1*fd1r) - (fa0*fd2r);
  74.  
  75.     spl0 = mix1 * dry0 + mix * (fd0l + fd1l + fd1l + fd2l);
  76.     spl1 = mix1 * dry1 + mix * (fd0r + fd1r + fd1r + fd2r);
  77.   ) : (
  78.     fd0l = (fk*dry0) - (fa1*fd1l) - (fa0*fd2l);
  79.     fd0r = (fk*dry1) - (fa1*fd1r) - (fa0*fd2r);
  80.  
  81.     wet0 = fd0l + fd1l + fd1l + fd2l;
  82.     wet1 = fd0r + fd1r + fd1r + fd2r;
  83.  
  84.     spl0=min(max(spl0,-1),1);
  85.     spl1=min(max(spl1,-1),1);
  86.  
  87.     wet0 = sin(wet0 * halfpi);
  88.     wet1 = sin(wet1 * halfpi);
  89.  
  90.     spl0 = mix1 * dry0 + mix * wet0;
  91.     spl1 = mix1 * dry1 + mix * wet1;
  92.   );
  93.  
  94.   fd2l = fd1l;
  95.   fd2r = fd1r;
  96.  
  97.   fd1l = fd0l;
  98.   fd1r = fd0r;
  99.  
  100.   spl0=min(max(spl0,-1),1);
  101.   spl1=min(max(spl1,-1),1);
  102.