home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2008 February
/
PCWorld_2008-02_cd.bin
/
audio-video
/
reaper
/
reaper2028-install.exe
/
Effects
/
LOSER
/
SP1LimiterJS
< prev
next >
Wrap
Text File
|
2007-12-09
|
2KB
|
85 lines
// (C) 2006, Michael Gruhn.
// NO WARRANTY IS GRANTED. THIS PLUG-IN IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
// WARRANTY OF ANY KIND. NO LIABILITY IS GRANTED, INCLUDING, BUT NOT LIMITED TO,
// ANY DIRECT OR INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGE ARISING
// OUT OF THE USE OR INABILITY TO USE THIS PLUG-IN, COMPUTER FAILTURE OF
// MALFUNCTION INCLUDED. THE USE OF THE SOURCE CODE, EITHER PARTIALLY OR IN
// TOTAL, IS ONLY GRANTED, IF USED IN THE SENSE OF THE AUTHOR'S INTENTION, AND
// USED WITH ACKNOWLEDGEMENT OF THE AUTHOR. FURTHERMORE IS THIS PLUG-IN A THIRD
// PARTY CONTRIBUTION, EVEN IF INCLUDED IN REAPER(TM), COCKOS INCORPORATED OR
// ITS AFFILIATES HAVE NOTHING TO DO WITH IT. LAST BUT NOT LEAST, BY USING THIS
// PLUG-IN YOU RELINQUISH YOUR CLAIM TO SUE IT'S AUTHOR, AS WELL AS THE CLAIM TO
// ENTRUST SOMEBODY ELSE WITH DOING SO.
desc:Simple Peak-1 Limiter
slider1:-0<-20,0,.1>Treshold (dB)
slider2:0,REDUCTION (dB)
@init
gain = 1; c = 8.65617025; dc = 10^(-30);
gr_meter=1;
gr_meter_decay = exp(1/(1*srate));
@slider
thresh = exp(slider1/c); seekgain = 1;
gain = 1;
t = 0;
b = -exp(-62.83185307 / srate );
a = 1.0 + b;
@sample
rms = max( abs(spl0) , abs(spl1) );
rms = max( sqrt( (t = a*rms-b*t+dc)-dc) , rms);
(rms > thresh) ? gain = rms : gain = thresh;
spl0 /= gain;
spl1 /= gain;
slider2 = log(thresh/gain)*c;
sliderchange(2);
gain < gr_meter ? gr_meter=gain : ( gr_meter*=gr_meter_decay; gr_meter>1?gr_meter=1; );
@gfx 0 24 // request horizontal/vertical heights (0 means dont care)
gr_meter *= exp(1/30); gr_meter>1?gr_meter=1; // decay meter here so if the audio processing stops it doesnt "stick"
gfx_r=1; gfx_g=gfx_b=0; gfx_a=0.8;
meter_bot=20;
meter_h=min(gfx_h,32);
xscale=gfx_w*20/meter_bot;
gfx_y=0;
gfx_x=gfx_w + log10(gr_meter)*xscale;
gfx_rectto(gfx_w,meter_h);
gfx_r=gfx_g=gfx_b=1.0; gfx_a=0.6;
s2=sqrt(2)/2;
g = s2;
while(
gfx_x=gfx_w + log10(g)*xscale;
gfx_x >= 0 ?
(
gfx_y=0;
gfx_lineto(gfx_x,meter_h,0);
gfx_y=meter_h-gfx_texth;
gfx_x+=2;
gfx_drawnumber(log10(g)*20,0);
gfx_drawchar($'d');
gfx_drawchar($'B');
);
g*=s2;
gfx_x >=0;
);
gfx_a=1;
gfx_x=0; gfx_y=meter_h/2 - gfx_texth/2;
gfx_drawnumber(log10(gr_meter)*20,1);
gfx_drawchar($'d');
gfx_drawchar($'B');