home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 January / PCWorld_2007-01_cd.bin / temacd / reaper / reaper147-install.exe / Effects / Delay / delay_tone < prev    next >
Text File  |  2005-06-24  |  2KB  |  78 lines

  1. // This effect Copyright (C) 2004 and later Cockos Incorporated
  2. // License: GPL - http://www.gnu.org/licenses/gpl.html
  3. desc: digital delay with tone controls
  4. slider1:300<0,4000,20>length (ms)
  5. slider2:-4<-120,6,0.1>feedback (dB)
  6. slider3:0<-60,60,0.1>bass gain (dB)
  7. slider4:200<20,24000,10>bass frequency (Hz)
  8. slider5:0<-60,60,0.1>treble gain (dB)
  9. slider6:4000<20,24000,10>treble frequency (Hz)
  10. slider7:0.5<0,1,0.01>output mix
  11.  
  12. @init
  13. delaypos=0;
  14. Bc0=Bc1=Bc2=0;
  15. Bli1=Bli2=Bri1=Bri2=0;
  16. Tc0=Tc1=Tc2=0;
  17. Tli1=Tli2=Tri1=Tri2=0;
  18. ldelay1=ldelay2=rdelay1=rdelay2=0;
  19.  
  20. @slider
  21. odelay=delaylen;
  22. delaylen=min(slider1 * srate / 1000,500000);
  23. freembuf(delaylen*2);
  24. delaypos >= delaylen || delaypos < 0 ? delaypos=0;
  25.  
  26. wetmix = 2^ (slider2/6);
  27. wetmix2 = slider7;
  28. drymix2 = 1-slider7;
  29.  
  30. width=1.5;
  31. // bass control
  32. arc=slider4*$pi/(srate*0.5);
  33. gain=(2 ^ (slider3/6));
  34. a=(sin(arc)*width) * (gain < 1 ? 1 : 0.25);
  35. tmp=1/(1+a);  
  36. Bc0=tmp*a*(gain-1);
  37. Bc1=tmp*2*cos(arc);
  38. Bc2=tmp*(a-1);
  39.  
  40. // treble control
  41. arc=slider6*$pi/(srate*0.5);
  42. gain=(2 ^ (slider5/6));
  43. a=(sin(arc)*width) * (gain < 1 ? 1 : 0.25);
  44. tmp=1/(1+a);  
  45. Tc0=tmp*a*(gain-1);
  46. Tc1=tmp*2*cos(arc);
  47. Tc2=tmp*(a-1);
  48.  
  49.  
  50.  
  51. @sample
  52. dpint = delaypos*2;
  53. os1=dpint[0];
  54. os2=dpint[1];
  55.  
  56. // apply EQ to os1/os2
  57.  
  58. Btmp=Bc0*(os1-ldelay2) + Bc1*Bli1 + Bc2*Bli2;
  59. Ttmp=Tc0*(os1-ldelay2) + Tc1*Tli1 + Tc2*Tli2;
  60. ldelay2=ldelay1; ldelay1=os1; 
  61. Tli2=Tli1; os1 += (Tli1=Ttmp);
  62. Bli2=Bli1; os1 += (Bli1=Btmp);
  63.  
  64. Btmp=Bc0*(os2-rdelay2) + Bc1*Bri1 + Bc2*Bri2;
  65. Ttmp=Tc0*(os2-rdelay2) + Tc1*Tri1 + Tc2*Tri2;
  66. rdelay2=rdelay1; rdelay1=os2; 
  67. Tri2=Tri1; os2 += (Tri1=Ttmp);
  68. Bri2=Bri1; os2 += (Bri1=Btmp);
  69.  
  70.  
  71. dpint[0]=min(max(spl0 + os1*wetmix,-4),4);
  72. dpint[1]=min(max(spl1 + os2*wetmix,-4),4);
  73.  
  74. (delaypos+=1) >= delaylen ? delaypos=0;
  75.  
  76. spl0=spl0*drymix2 + os1*wetmix2;
  77. spl1=spl1*drymix2 + os2*wetmix2;
  78.