Csound Csound-dev Csound-tekno Search About

Re: Compressor/Limiter

Date1999-10-29 15:53
FromVarga István
SubjectRe: Compressor/Limiter
"Michael A. Thompson"  wrote:

> Looking for a good compressor/limiter csound .orc. Anybody messed around
> with doing one?

What sort of compressor/limiter do you want ? For compression, I have some
orc files (and one of the drum instruments also uses compression); for removing
peaks (this is not really compression), I use this:
http://www.geocities.com/SiliconValley/Bit/5683/maximizer-1.0.zip
Note that this program is really for removing large peaks (mostly caused by
bass instruments), it cannot change the average volume. It is also
written in C, so you may not like it. As of compressor orcs, you can find them at
http://www.geocities.com/SiliconValley/Bit/5683/compress.zip

Some simple test files:
http://www.geocities.com/SiliconValley/Bit/5683/testfiles.zip
(It eats up lots of space on the server, so will be removed soon)

Files in the archive are:

test1.mp2: original signal, scaled to 32000
test2.mp2: compressed with Limit412.orc (see below)
test3.mp2: processed with "maximizer", command-line flags:

        -verbose -smode 0 -lmode 0 -limit 14000          \
        -clpl1 14000 -clpl2 15625 -nband 9 -ovrlp 4      \
        -freq2 1000 -scale 2.048 -r_lim a 1.0            \
        -clpsn 0 4.0 -clpsn 1 2.0 -clpsn 2 1.4           \
        -clpsn 3 1.0 -clpsn 4 0.7 -clpsn 5 1.0           \
        -clpsn 6 1.2 -clpsn 7 1.4 -clpsn 8 2.0           \
        -clpsn 9 4.0
   (this may need some more experimenting)

test4.mp2: simply clipped (see "clip.orc")

-------- Limit412.orc --------

sr      =  44100
kr      =  44100
ksmps   =  1
nchnls  =  2

        instr 1

iamp    =  2.048
imax1   =  14000
idel1   =  20
idec1   =  0.01
iatt1   =  0.0001
ifrq1   =  25
imax2   =  14000
idel2   =  2.5
idec2   =  0.5
iatt2   =  0.0025
ifrq2   =  200

a1,a2   soundin "mix.sf"

idel1   =  idel1*0.001
idel2   =  idel2*0.001
klv01   init 0
klv02   init 0

ad1     delay a1,idel1
ad2     delay a2,idel1

klx1    downsamp abs(a1)
klx2    downsamp abs(a2)
klx     =  (klx1>klx2 ? klx1:klx2)
klv01   =  (klx>klv01 ? klv01+(klx-klv01)*idec1:klv01+(klx-klv01)*iatt1)
al1     upsamp klv01
al1     butterlp al1,ifrq1
klv01x  downsamp al1

a1      =  (klv01xklx2 ? klx1:klx2)
klv02   =  (klx>klv02 ? klv02+(klx-klv02)*idec2:klv02+(klx-klv02)*iatt2)
al1     upsamp klv02
al1     butterlp al1,ifrq2
klv02x  downsamp al1

ad1     =  (klv02x