Giter VIP home page Giter VIP logo

Comments (5)

velipso avatar velipso commented on July 19, 2024

If rate is integral multiple of freq

It isn't for most values of freq... but let's assume it is.

If freq is set to 441Hz, and rate is set to 44100 samples per second, then omega will be:

2 * PI * 441 / 44100 = 0.06283185307179585

Then sn and cs will be:

Sin(0.06283185307179585) = 0.06279051952931336
Cos(0.06283185307179585) = 0.9980267284282716

That being said, now that I'm looking at the code, if freq <= 0 or >= rate/2, then it looks like your logic is right -- sn will be 0, which gets a divide by zero. If I trace the sources of freq, I can see that a user could pass in a 0 for basslpf in the advanced options, and cause that to happen.

So I think the clamp should probably be fixed.

from sndfilter.

neevek avatar neevek commented on July 19, 2024

I just run into the case that freq >= rate/2 with default settings with all presets other than LARGEHALL1 and LARGEHALL2. With the same input, only LARGEHALL1 and LARGEHALL2 work, all other presets will zero out the samples because of the divide by zero issue.

from sndfilter.

velipso avatar velipso commented on July 19, 2024

I don't have time to fix at the moment, but a quick fix is to simply change the biquad coefficients to be a passthrough. In order to do that, you set b0 to 1, and the rest (b1, b2, a1, a2) to 0.

from sndfilter.

neevek avatar neevek commented on July 19, 2024

I don't have time to fix at the moment, but a quick fix is to simply change the biquad coefficients to be a passthrough. In order to do that, you set b0 to 1, and the rest (b1, b2, a1, a2) to 0.

I set alpha to 1 when sn is 0, which seemed to work as expected.

from sndfilter.

velipso avatar velipso commented on July 19, 2024

thanks, sorry it took so long to fix, I don't check here often but I had some free time today

from sndfilter.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.