[music-dsp] Soft-knee algo & implementation
Citizen Chunk
citizenchunk at nyc.rr.com
Sat Jan 3 21:45:01 EST 2004
hi all. happy new year!
i've been trying to figure out how to implement a soft-knee in my VST
compressor. the Soft parameter will range from 0 to 1.0, where 1.0 is a
curve from twice the threshold (in dB) to half of the threshold. e.g.
if thresh = -12dB, the curve will run from -24dB to -6dB when the
soft-knee is set to 1.0. at soft = 0, there will be a corner at -12dB.
i first figured that i should set a Hi and Lo soft threshold, based on
the criteria above. i came up with:
softThreshLo = thresh ^ ( 1 + k )
softThreshHi = thresh ^ ( 1 / ( 1 + k ) )
then in my sample loop, after the envelope has been calculated ...
if ( env > softThreshHi ) // if the envelope is out of soft knee range
gR = ( thresh / env ) ^ ( 1 - ratio ) // regular gain reduction
else if ( env > softThreshLo ) // if envelope is in soft range
gR = ( thresh / env ) ^ ( 1 - ratio ) // calculate regular gain
reduction
gR = gR ^ ( (env - softThreshLo) / (softThreshHi - softThreshLo) )
else
gR = 1 // otherwise, gain reduction set to unity
out = in * gR
the problem with this scenario is that, if you graph it, the transfer
curve has a hump in the soft-knee range. in other words, the soft-knee
is actually LOUDER than the hard-knee transfer function in the
"soft-zone". i've tried all sorts of different transfer functions, but
nothing seems to work.
does anyone have some advice? perhaps a better way of going about this?
am i missing something fundamental here?
More information about the music-dsp
mailing list