home *** CD-ROM | disk | FTP | other *** search
/ PC World 2006 October / PCWorld_2006-10_cd.bin / audio-video / reaper / reaper105-install.exe / Effects / Utility / bitred next >
Text File  |  2006-08-24  |  775b  |  41 lines

  1. desc:bit depth reduction
  2.  
  3. slider1:8<1,24,1>resolution (bits)
  4. slider2:0<-48,48,1>input gain (dB)
  5. slider3:0<0,1,1{off,on}>dither
  6. slider4:0<0,1,1{off,on}>noiseshape
  7. slider5:0<0,1,1{rect,tri}>dither type
  8.  
  9. @slider
  10. resol=2^((slider1|0)-1); 
  11. invresl=1/resol; 
  12. gain=2^(slider2/6);
  13. dit=slider3?1:0;
  14. s=slider4>0.5?0.25:0;
  15. s1l=s1r=s2l=s2r=0;
  16. ldv=0;
  17.  
  18. @sample
  19.  
  20.  
  21. a0=max(min(spl0*gain,1),-1) + s * (s1l+s1l - s2l);
  22. a1=max(min(spl1*gain,1),-1) + s * (s1r+s1r - s2r);
  23.  
  24. dit ? (
  25.   slider5==1?( 
  26.     dv=(rand(5000)+rand(5000))/10001;
  27.   ):
  28.    dv=rand(9999)*0.0001;
  29. ) : dv=0;
  30.  
  31.  
  32. spl0 = max(min((floor(a0*resol + dv))*invresl,1),-1);
  33. spl1 = max(min((floor(a1*resol + dv))*invresl,1),-1);
  34.  
  35. s2l=s1l;
  36. s2r=s1r;
  37.  
  38. s1l = a0 - invresl*spl0;
  39. s1r = a1 - invresl*spl1;
  40.  
  41.