[MPlayer-dev-eng] Soft volume clip methods

Alex Beregszaszi alex at fsn.hu
Mon Feb 21 17:35:02 CET 2005


Hi,

> The current softclip method used my libaf is sin(x), which is slow,
> and becomes hard at 4dB.  What are the requirements for a good clip
> functions?  Obviously, it must clip to [-1,+1], it's first derivative
> at zero must be 1, it must be strictly increasing and and it must
> satisfy f(-x) = -f(x).  The rest are fuzzy, like it should be
> reasonable smooth etc.  For example, what about this much faster
> function:
> 
> sign(x) * (1 - (2-abs(x))^2/4)  for -2 < x < 2 and sign(x) otherwise.
> 
> This hard clips above 6dB.  And there are other possible clip
> functions which have no hard limit, e.g. sign(x) * (1 - exp(-abs(x)))
> or 2*atan(2x/pi)/pi or similar, like in
> http://www.musicdsp.org/showone.php?id=104, but these are slow, what
> would be a good unbounded clip funciton with parameterizable hardness?

Dunno, but your functions reduce dynamic range hardly, maybe you would
need to rescale and leave the [-1.0, +1.0] samples as is.

Attached is a simple test program written by me.

-- 
Alex Beregszaszi 			e-mail: alex at fsn.hu
Free Software Network			cell: +36 70 3144424

-------------- next part --------------
A non-text attachment was scrubbed...
Name: softclip.c
Type: text/x-csrc
Size: 604 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20050221/f40d8de1/attachment.c>


More information about the MPlayer-dev-eng mailing list