Welcome Guest ( Log In | Register )

issue on opus_pcm_soft_clip() function
post Sep 13 2013, 06:39
Post #1

Group: Developer
Posts: 657
Joined: 22-November 10
From: Japan
Member No.: 85902

I played around a bit on opus_pcm_soft_clip(), and I noticed that it occasionally yields audible noises when I feed simple sine wave with peak above 0dBFS to it.

It seems that opus_pcm_soft_clip() function can yields noise on special cases, where ending of previous frame is not soft clipped but beginning of new frame requires soft clipping.
I'm not a smart guy and not quite familiar with DSP, but as far as I understand:

This filter uses the following transfer function:
f(x) = x (ordinary case)
f(x) = x + ax^2 (soft clipping case, a is chosen so that f(x) = 1 on peak value)

Usually, soft clip is only applied on surrounding points of clipping, from nearest previous zero crossing point to nearest next zero crossing point.
Zero crossing point is used as boundary because two function above can be smoothly connected only at x = 0.

However, on the "special case", this function has to use non zero-crossing point as boundary. This is already specially taken care of so that result is at least "continuous", but it is not "smooth" (differentiable). And it seems to result in widely spread frequency components and audible noise at the boundary point.

I think this can be avoided by processing only until the final zero crossing point, and returning minimum of number of processed samples for each channels. And only when there is no more input, all remaining input can be processed.
This requires slightly more complex book keeping, but it's possible. I don't know it's worth doing, though.

Anyway, test program is attached.
Attached File  softclip.zip ( 25.48K ) Number of downloads: 92
Go to the top of the page
+Quote Post

Posts in this topic

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:


RSS Lo-Fi Version Time is now: 3rd August 2015 - 05:52