;
;Compressor/Limiter
; Compression Curve
; # time size gen y len y len y len y
f 6 0 1025 7 1 256 1 256 .5 513 .5
; read in wave file
; p4
; # sta dur gain
i 1 0 6 1.25
; Compressor
; p3 p4 p5 p6 p7 p8 p9
; # sta dur rmstime deltime f postgain inch outch
i 2 0 6 .02 .01 6 1 1 2
sr = 48000
kr = 4800
ksmps = 10
nchnls = 2
zakinit 30, 30
; read in stereo wave file to two separate audio signals
instr 1
ar1, ar2 soundin "clip24_6s.wav"
zaw ar1*p4, 1
;outs ar1*p4, ar1*p4
endin
; compressor
instr 2
ifqc = 1/p4
ideltm = p5
itab = p6
ipostgain = p7
iinch = p8
ioutch = p9
kenv linseg 0, .02, 1, p3-.04, 1, .02, 0
asig zar iinch
kamp rms asig, ifqc
kampn = kamp/30000
kcomp tablei kampn, itab, 1, 0
adel1 delayr ideltm
delayw asig
acomp = kcomp*adel1*ipostgain
zaw acomp*kenv, ioutch
outs acomp*kenv, acomp*kenv
endin