electro-smith / DaisySP

A Powerful DSP Library in C++
https://www.electro-smith.com/daisy
Other
839 stars 132 forks source link

Svf fix #126

Closed beserge closed 3 years ago

beserge commented 3 years ago

Fixes the crashing bug by making resonance work internally from .05-1. A better fix should be coming.

stephenhensley commented 3 years ago

Converted to draft while we provide additional fixes.

as a brute-force fix to the actual crash issue we can:

if (low_ != low_)
    low_ = 0.f;

for low_, band_, high_, peak_, notch_

but that's not very efficient being called 48000 times a second. So, it'd be ideal to find what is causing NaN in the first place.

anything that would end up with 1 / x where x is NaN, infinity or -infinity would result in NaN (or multiplying against inf/-inf)

Based on my experience and the notes in the #72 this could be more common on signals with big transients square waves seem the most common culprit). Though, you mentioned seeing it crash with a steady input of just 1.0f.