home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 January / PCWorld_2007-01_cd.bin / temacd / reaper / reaper147-install.exe / Effects / SStillwell / chorus_stereo < prev    next >
Text File  |  2006-08-17  |  2KB  |  103 lines

  1. // This effect Copyright (C) 2004 and later Cockos Incorporated
  2. // License: GPL - http://www.gnu.org/licenses/gpl.html
  3.  
  4.  
  5. desc:chorus
  6.  
  7. slider1:15<1,500>chorus length (ms)
  8. slider2:1<1,8,1>number of voices
  9. slider3:0.5<0,16,0.01>rate (hz) 0 for beatsync
  10. slider4:0.7<0,1>pitch fudge factor
  11. slider5:-6<-100,12,1>wet mix (dB)
  12. slider6:-6<-100,12,1>dry mix (dB)
  13. slider7:0.0<-1,1,0.01>channel rate offset (hz)
  14. slider8:0.25<0.0625,4,0.0625>beat sync (fraction of whole note)
  15.  
  16. @init
  17.  
  18. bpos=0;
  19.  
  20. @slider
  21.  
  22. numvoices=min(16,max(slider2,1));
  23. choruslen=slider1*srate*0.001;
  24.  
  25. i0=0;
  26. i1=0;
  27. i=0;
  28. loop(numvoices, 
  29.   i0[0]=(i+1)/numvoices*$pi; 
  30.   i1[0]=(i+1)/numvoices*$pi;
  31.   i+=1; 
  32. );
  33. bufofs0=32768;
  34. bufofs1=32768;
  35.  
  36. csize=choruslen/numvoices * slider4;
  37.  
  38. slider3==0 ? (
  39.   rateadj=tempo/(240*slider8)*2*$pi/srate;
  40.   rateadj0=tempo/(240*slider8)*2*$pi/srate;
  41.   rateadj1=(tempo/(240*slider8)+slider7)*2*$pi/srate;
  42. ):(
  43.   rateadj=slider3*2*$pi/srate;
  44.   rateadj0=slider3*2*$pi/srate;
  45.   rateadj1=(slider3+slider7)*2*$pi/srate;
  46. );
  47. wetmix = 2 ^ (slider5/6);
  48. drymix = 2 ^ (slider6/6);
  49.  
  50.  
  51. @sample
  52.  
  53. slider3==0 ? (
  54.   rateadj=tempo/(240*slider8)*2*$pi/srate;
  55.   rateadj0=tempo/(240*slider8)*2*$pi/srate;
  56.   rateadj1=(tempo/(240*slider8)+slider7)*2*$pi/srate;
  57. ):(
  58.   rateadj=slider3*2*$pi/srate;
  59.   rateadj0=slider3*2*$pi/srate;
  60.   rateadj1=(slider3+slider7)*2*$pi/srate;
  61. );
  62.  
  63.  
  64. bpos0 >= choruslen ? (
  65.   bpos0=0;
  66. );
  67. os0=spl0;
  68. bpos1 >= choruslen ? (
  69.   bpos1=0;
  70. );
  71. os1=spl1;
  72.  
  73. // calculate new sample based on numvoices
  74.  
  75. spl0=spl0*drymix;
  76. spl1=spl1*drymix;
  77. vol=wetmix/numvoices;
  78. i0=0;
  79. i1=0;
  80.  
  81. loop(numvoices,
  82.    tpos0 = bpos0 - (0.5+0.49*(sin( $pi*(i0[0] += rateadj0))/($pi*i0[0]))) * (i0+1) * csize;
  83.    tpos1 = bpos1 - (0.5+0.49*(sin( $pi*(i1[0] += rateadj1))/($pi*i1[0]))) * (i1+1) * csize;
  84.  
  85.    tpos0 < 0 ? tpos0 += choruslen;
  86.    tpos1 < 0 ? tpos1 += choruslen;
  87.    tpos0 > choruslen ? tpos0 -= choruslen;
  88.    tpos1 > choruslen ? tpos1 -= choruslen;
  89.    
  90.    spl0 += bufofs0[tpos0] * vol;
  91.    spl1 += bufofs1[tpos1] * vol;
  92.  
  93.    i0+=1;
  94.    i1+=1;
  95. );
  96.  
  97.  
  98. bufofs0[bpos0]=os0;
  99. bufofs1[bpos1]=os1;
  100.  
  101. bpos0+=1;
  102. bpos1+=1;
  103.