home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2007 January
/
PCWorld_2007-01_cd.bin
/
temacd
/
reaper
/
reaper147-install.exe
/
Effects
/
SStillwell
/
ozzifier
< prev
next >
Wrap
Text File
|
2006-10-05
|
4KB
|
113 lines
// Copyright 2006, Thomas Scott Stillwell
// All rights reserved.
//
//Redistribution and use in source and binary forms, with or without modification, are permitted
//provided that the following conditions are met:
//
//Redistributions of source code must retain the above copyright notice, this list of conditions
//and the following disclaimer.
//
//Redistributions in binary form must reproduce the above copyright notice, this list of conditions
//and the following disclaimer in the documentation and/or other materials provided with the distribution.
//
//The name of Thomas Scott Stillwell may not be used to endorse or
//promote products derived from this software without specific prior written permission.
//
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
//IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
//FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
//BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
//(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
//PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
//STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
//THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
desc: ozzifier - pitch/delay doubler
slider1:2<0,6,1>Number of voices
slider2:10<0,120,0.1>time spread (ms)
slider3:20<0,120,1>pitch spread (cent)
slider4:-6<-120,6,1>wet mix (dB)
slider5:-6<-120,6,1>dry mix (dB)
slider6:100<0,100>pan spread%
@init
bufsize = srate;
bufloc0 = 10000;
bufloc1 = bufloc0+bufsize+1000;
voiceptr0loc = bufloc1+bufsize+1000;
voiceptr1loc = voiceptr0loc+1000;
voicerateloc = voiceptr1loc+1000;
cospanloc = voicerateloc+1000;
sinpanloc = cospanloc+1000;
buffer0 = bufloc0;
buffer1 = bufloc1;
voiceptr0 = voiceptr0loc;
voiceptr1 = voiceptr1loc;
voicerate = voicerateloc;
cospan = cospanloc;
sinpan = sinpanloc;
@slider
numvoices = slider1;
delaytime = slider2*0.001*srate;
pitchspread = slider3;
totalpitch = pitchspread * numvoices;
bufsize = delaytime;
overlap = bufsize / 16;
drymix = 2 ^ (slider5/6);
wetmix = 2 ^ (slider4/6);
panwidth = slider6/100;
lpan = 0.5 - (panwidth/2);
panincr = panwidth/max(1,numvoices-1);
i = 1;
loop(numvoices,
voicerate[i] = 2 ^ (-((totalpitch / 2) - (pitchspread * i)) / 1200);
voiceptr0[i] = bufloc0 + bufsize - (i/numvoices) * delaytime;
voiceptr1[i] = bufloc1 + bufsize - (i/numvoices) * delaytime;
(voiceptr0[i] < bufloc0) ? voiceptr0[i] += bufsize;
(voiceptr1[i] < bufloc1) ? voiceptr1[i] += bufsize;
cospan[i] = cos((lpan + (i - 1) * panincr) * $pi / 2);
sinpan[i] = sin((lpan + (i - 1) * panincr) * $pi / 2);
i += 1;
);
@sample
buffer0[0] = spl0;
buffer1[0] = spl1;
wet0 = wet1 = 0;
i = 1;
loop(numvoices,
wet0 += cospan[i] * voiceptr0[i][0];
wet1 += sinpan[i] * voiceptr1[i][0];
voiceptr0[i] += voicerate[i];
voiceptr1[i] += voicerate[i];
(voiceptr0[i] >= (bufloc0+bufsize)) ? voiceptr0[i] = bufloc0;
(voiceptr1[i] >= (bufloc1+bufsize)) ? voiceptr1[i] = bufloc1;
i += 1;
);
spl0 = wet0 * wetmix + spl0 * drymix;
spl1 = wet1 * wetmix + spl1 * drymix;
buffer0 += 1;
buffer1 += 1;
(buffer0 >= (bufloc0 + bufsize)) ? buffer0 = bufloc0;
(buffer1 >= (bufloc1 + bufsize)) ? buffer1 = bufloc1;