home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2006 October
/
PCWorld_2006-10_cd.bin
/
audio-video
/
reaper
/
reaper105-install.exe
/
Effects
/
Utility
/
bitred
next >
Wrap
Text File
|
2006-08-24
|
775b
|
41 lines
desc:bit depth reduction
slider1:8<1,24,1>resolution (bits)
slider2:0<-48,48,1>input gain (dB)
slider3:0<0,1,1{off,on}>dither
slider4:0<0,1,1{off,on}>noiseshape
slider5:0<0,1,1{rect,tri}>dither type
@slider
resol=2^((slider1|0)-1);
invresl=1/resol;
gain=2^(slider2/6);
dit=slider3?1:0;
s=slider4>0.5?0.25:0;
s1l=s1r=s2l=s2r=0;
ldv=0;
@sample
a0=max(min(spl0*gain,1),-1) + s * (s1l+s1l - s2l);
a1=max(min(spl1*gain,1),-1) + s * (s1r+s1r - s2r);
dit ? (
slider5==1?(
dv=(rand(5000)+rand(5000))/10001;
):
dv=rand(9999)*0.0001;
) : dv=0;
spl0 = max(min((floor(a0*resol + dv))*invresl,1),-1);
spl1 = max(min((floor(a1*resol + dv))*invresl,1),-1);
s2l=s1l;
s2r=s1r;
s1l = a0 - invresl*spl0;
s1r = a1 - invresl*spl1;