home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 March / PCWorld_2007-03_cd.bin / audio-video / reaper / reaper174-install.exe / Effects / Utility / bitred next >
Text File  |  2007-01-15  |  835b  |  43 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. slider6:0<0,1,1{off,on}>highpass dither
  9.  
  10. @slider
  11. resol=2^((slider1|0)-1); 
  12. invresl=1/resol; 
  13. gain=2^(slider2/6);
  14. dit=slider3?1:0;
  15. s=slider4>0.5?0.25:0;
  16. s1l=s1r=s2l=s2r=0;
  17. ldv=0;
  18.  
  19. @sample
  20.  
  21.  
  22. a0=max(min(spl0*gain,1),-1) + s * (s1l+s1l - s2l);
  23. a1=max(min(spl1*gain,1),-1) + s * (s1r+s1r - s2r);
  24.  
  25. slider6 ? dv2 = dv:dv2=0;
  26. dit ? (
  27.   slider5==1?( 
  28.     dv=(rand(5000)+rand(5000))/10001;
  29.   ):
  30.    dv=rand(9999)*0.0001;
  31. ) : dv=0;
  32.  
  33.  
  34. spl0 = max(min((floor(a0*resol + dv-dv2))*invresl,1),-1);
  35. spl1 = max(min((floor(a1*resol + dv-dv2))*invresl,1),-1);
  36.  
  37. s2l=s1l;
  38. s2r=s1r;
  39.  
  40. s1l = a0 - spl0;
  41. s1r = a1 - spl1;
  42.  
  43.