home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 January / PCWorld_2007-01_cd.bin / temacd / reaper / reaper147-install.exe / Effects / Pitch / octavedown < prev    next >
Text File  |  2005-06-24  |  952b  |  44 lines

  1. // This effect Copyright (C) 2004 and later Cockos Incorporated
  2. // License: GPL - http://www.gnu.org/licenses/gpl.html
  3.  
  4. desc: octave down
  5. slider1:150<4,500,10>Chunk (ms)
  6. slider2:0.5<0,1>Overlap (0..1)
  7. slider3:0<-120,6,1>wet mix (dB)
  8. slider4:-120<-120,6,1>dry mix (dB)
  9.  
  10. @init
  11. bufsize=-1;
  12.  
  13. @slider 
  14. nbufsize=srate*0.001*slider1; nbufsize=nbufsize&65534; 
  15. nbufsize != bufsize ? (bufsize=nbufsize; bufpos=0);
  16. slider2=min(1,max(0,slider2)); rspos=bufsize*slider2; invbs=1/rspos;
  17. drymix=2 ^ (slider4/6); wetmix=2 ^ (slider3/6);
  18.  
  19.  
  20. @sample
  21. ss0=spl0;
  22. ss1=spl1;
  23.  
  24. hbp=bufpos&65534;
  25. s0r=bufsize[hbp]; // read these early
  26. s1r=bufsize[hbp+1];
  27.  
  28. (bufpos*2)[0]=spl0;
  29. (bufpos*2)[1]=spl1;
  30.  
  31. bufpos < rspos ? (
  32.   sc=bufpos*invbs;
  33.   spl0=hbp[0]*sc + s0r*(1-sc);
  34.   spl1=hbp[1]*sc + s1r*(1-sc);
  35. ) : (
  36.   spl0=hbp[0];
  37.   spl1=hbp[1];
  38. );
  39.  
  40. (bufpos+=1) >= bufsize ? bufpos=0;
  41.  
  42. spl0=spl0*wetmix + ss0*drymix;
  43. spl1=spl1*wetmix + ss1*drymix;
  44.