Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Filter clipping

DSP related issues, mathematics, processing and techniques

Filter clipping

Postby Rocko » Sat Jun 06, 2015 12:54 pm

Hi all,

I'm experimenting with different types of filters and they all seem to clip when the input is close to FS (full scale).
I was wandering why and if there is a way to overcome this issue.

I have attached an example which uses 'Dozius filter pack' imported to F.S. from S.M.
In this example, input of a sine wave, at full-scale, will lead to clipping, when output is the summed LPF and HPF.
Reducing the filter OUTPUT by (-0.44 [Db]) solves it, but... My question is why is this happening in the first place?

Is it because of a phase issue between the LPF and HPF?
Looking at a repsonse curve of the filter, I see a very slight increase in gain around the cut-off point. Is that it or is there a more profound reason, caused by FlowStone itself?

[i.e. - if I copy the same filter to a C/C++ environment, with exact same settings and 32 bit F.P. - will I receive similar clipping]?

--> See example attached. choose a filter state for the deired setting (12,24,36, etc.)

Thanks
Attachments
filter_clipping.fsm
(30.5 KiB) Downloaded 1412 times
Rocko
 
Posts: 186
Joined: Tue May 15, 2012 12:42 pm

Re: Filter clipping

Postby KG_is_back » Sat Jun 06, 2015 2:38 pm

The answer is very simple - it is not the filter that is clipping - it's your soundcard. Soundcards can only reproduce signals within <-1,1> range (actually slightly less then that because of intersample peaks). If you drive your soundcard output with signal outside <-1,1> range it will get clipped. It has nothing to do with the filter itself. The filter simply produces signal that is too hot.
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Filter clipping

Postby Rocko » Sat Jun 06, 2015 7:30 pm

Thanks KG, appreciated.

I'll experiment a bit with differnet soundcrads, just for fun.

I intend the final module to be resiliant to soundcrad quality, so, I guess I'll need a clip-limiter.
I have some experience with simple 'sample by sample' limiters:

Code: Select all

'if (abs(sample) >= 0.99) then sample=signed(0.99) else sample'


But this is not good enough for this design in which the filters are fed-back and create high clipping.
Should I be heading towards a look-ahead-limiter then ??

Thanks,
Rocko
Rocko
 
Posts: 186
Joined: Tue May 15, 2012 12:42 pm

Re: Filter clipping

Postby KG_is_back » Sat Jun 06, 2015 9:04 pm

The preferred approach is to keep the output at around -18dB RMS, which is kind of an standard and sweet-spot for best quality across all analogue and digital devices. There is rarely a reason to cut it so close to clipping range - if the user needs more volume, he should turn up the speakers.

If you want to be on the safe side, you may either use clipper, or a limiter with lookahead. limiter will give less distortion, but wastes CPU power. IMHO the best thing to do is to add output meter to the GUI with BIG RED LEDS indicating clipping.
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Filter clipping

Postby Rocko » Fri Aug 07, 2015 2:44 am

BTW -

You mention 'inter sample' clipping.
Could you please shed some light on that or refer me to some links/literature?

Appreciated,
Rocko
Rocko
 
Posts: 186
Joined: Tue May 15, 2012 12:42 pm

Re: Filter clipping

Postby KG_is_back » Fri Aug 07, 2015 3:27 am

When sampled data is converted to continuous (understand the digital->Analog conversion) the samples are not simply connected with straight lines, nor with stairs. Instead they are jointed with a smooth curve, as seen on the image below.
Image

As you can see, the real amplitude of the wave (the real peak) may (and almost always is) a little higher, than the value of maximum sample. These are referred to as inter-sample peaks and are a reason why limiting the samples to <-1,1> range is not sufficient to prevent clipping (even though samples do not exceed <-1,1> the real wave that they represent does).
Inter-sample peaks are negligible for low frequency waves and get bigger when you approach nyquist frequency (high-end of the spectrum). That's quite a problem, because high-frequency content is most prominent in transients, which are also the loudest part of sounds.
Many high-end limiters and clippers have ways of detecting inter-sample-peaks (by estimating the shape of curve in-between samples) and adjust gain reduction accordingly, so technically speaking with such plugins you can set your threshold to 0dBFS and don't have to fear. But most mixing-engineers tend not to trust them and rather set their thresholds to -0.1dBFS just to be on the safe side (it's hard to tell how efficient the ISP-detection is in that particular plugin).
That is rather on backwards compatibility thing. Most modern hardware is manufactured with inter-sample-peaks in mind (basically the devices have headroom slightly bigger than <-1,1> on their outputs). That might not be the case for older or lower quality devices (e.g. cheap MP3 players), so still it's better to be safe than sorry...
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia


Return to DSP

Who is online

Users browsing this forum: No registered users and 28 guests