home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2006 October
/
PCWorld_2006-10_cd.bin
/
audio-video
/
reaper
/
reaper105-install.exe
/
Effects
/
Pitch
/
mdct-shift
next >
Wrap
Text File
|
2005-06-24
|
2KB
|
66 lines
// This effect Copyright (C) 2004 and later Cockos Incorporated
// License: GPL - http://www.gnu.org/licenses/gpl.html
desc: MDCT shift
slider1:128<32,512,153.6>bands
slider2:4<-512,512,1>band shift (positive is shift up)
@slider
slider1=2 ^ (0|(0.5+log10(slider1)/log10(2)))|0;
slider1=min(512,max(slider1,32));
fftsize!=slider1*2 ? (fftsize=slider1*2; bufpos=bi1=0;+bi2=fftsize*2; halfsize=fftsize*0.5);
slider2=min(slider1,max(slider2,-slider1));
@sample
// bi2 was the previously transformed buffer, and by the time it
// is bi2 we only touch the second half (the first was replaced when
// it was bi1)
// bi1 is the most recently transformed buffer, we only touch the first
// half, because the second will be used for the next overlap
t=bi1+bufpos;
p0=t[0];
t[0]=spl0;
t=bi2+halfsize+bufpos;
p1=t[0];
t[0]=spl0;
spl0 = p0 + p1; // our mdct handles windowing, so we just add
bufpos+=1;
bufpos >= halfsize ?
(
// swap bi1 and bi2
t=bi1; bi1=bi2; bi2=t;
// we hit our FFT size here
mdct(bi1,fftsize);
slider2 > 0 ?
(
bufpos=bi1+halfsize;
loop(halfsize-slider2,
bufpos[0]=bufpos[-slider2];
bufpos-=1;
);
loop(slider2,bufpos[0]=0; bufpos-=1;)
) : (
bufpos=bi1;
loop(halfsize+slider2,
bufpos[0]=bufpos[-slider2];
bufpos+=1;
);
loop(-slider2,bufpos[0]=0; bufpos+=1)
);
imdct(bi1,fftsize);
bufpos=0;
);
spl1=spl0;