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

Recursive filters lockup and remedy

Post any examples or modules that you want to share here

Recursive filters lockup and remedy

Postby martinvicanek » Wed Sep 20, 2017 2:54 am

Hi gang,

We all use recursive filters (biquads and such) because they are so efficient. However, one disadvantage is that if you feed such a device with invalid data (such as the result of a division by zero), it will lock up because NaNs (Not a Number) will forever feed back. In that case, the only remedy is to interrupt the audio stream.

Of course it is best to avoid NaNs in the first place, but you are not always in control. One possible workaround is to block incoming NaNs from polluting the subsequent signal path. In the schematic below, the NaN Blocker replaces NaNs by zeros, while passing valid stream data unchanged.

If you have a complex schematic with many recursive components, it might be difficult to place potentially many NaN blockers at the right spots. Then you might analyze the audio stream at the end and clear audio on NaN detection there. The schematic below has a module which does exactly this.

Let me repeat: avoid NaNs in the first place if possible. A division by zero may be due to lack of a proper initialization (happened to me before).

Have fun!
NaN Remedy Hack.fsm
(28.32 KiB) Downloaded 973 times

Edit; Upgraded version to take care of division by zero.
NaN Inf Remedy Hack.fsm
(28.75 KiB) Downloaded 961 times
Last edited by martinvicanek on Tue Sep 26, 2017 6:52 pm, edited 1 time in total.
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm

Re: Recursive filters lockup and remedy

Postby Spogg » Wed Sep 20, 2017 8:25 am

I've had that happen!

So much so I've had to choose alternative filters in some cases, so this could be very useful for me.

I've also had instances of delays causing a lockup sometimes. I found experimentally that using one of your DC blockers (a HPF set to 20Hz) can sometimes stop this happening. Could this behaviour in a delay also be a NaN issue?

Thanks for sharing this Martin. You are a real treasure to have around mate.

Spogg
User avatar
Spogg
 
Posts: 3358
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England

Re: Recursive filters lockup and remedy

Postby martinvicanek » Wed Sep 20, 2017 8:40 am

Yes, delays are also prone to lockups if they use feedback as in an echo effect. Other candidates are:
-fractional delays with an allpass interpolator
- comb fiters
- recursive oscillators (includes harmonic oscs and everything based on a naive saw!)
- ring buffers
Simply all recursive structures.

Hm, it is surprising that a highpass filter should help, as the HPF is itself a recursive beast and thus adds to the problem. :o
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm

Re: Recursive filters lockup and remedy

Postby Spogg » Wed Sep 20, 2017 11:55 am

martinvicanek wrote:
Hm, it is surprising that a highpass filter should help, as the HPF is itself a recursive beast and thus adds to the problem. :o


I think maybe the delays were responding badly to an overall dc offset in the audio, but I don't know for sure. Next time I come across the issue I'll try your NaN blocker first and report back...

Cheers

Spogg
User avatar
Spogg
 
Posts: 3358
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England


Return to User Examples

Who is online

Users browsing this forum: No registered users and 37 guests