Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please provide a single, simple, complete working example of creating and applying a filter #24

Open
cdcv opened this issue Feb 23, 2019 · 1 comment

Comments

@cdcv
Copy link

cdcv commented Feb 23, 2019

EDIT to ISSUE: I now notice that you actually do have a complete working demo that's referenced in the README. I managed to miss it. I'm guessing that others have as well. Can you please add example code into the readme, as described below, and mention the demo in the section that describes how to use the code. Yes, I now see that the demo is prominently listed at the top of the readme... but that's actually exactly the reason that I didn't see it. Thank you again.

Thank you for creating what looks like a lovely js filter package... which is exactly what I need. Just wish I could use it.
I'd like to ask if you'd take what I hope might only be a few minutes to please create what I think most users will need to be able to use the library without having to reverse-engineer it: a simple, complete, working .js file example. I think this could be only a half dozen or a dozen lines of code. Please illustrate the most basic real-world use-case: how to take an input signal, apply a bandpass (or other) filter to it, and generate a filtered output.
Despite the relatively careful documentation, I'm still not able to actually use this library to do this... which obviously doesn't seem like your intended outcome. At this point, it's not clear if I should keep trying, or go on to another DSP library and start over.
I'm trying to do what I think is the single most basic thing that I expect (many if not most) users of this library would want: create a basic digital filter, apply it to a signal, receive a filtered output.
There is documentation regarding the individual steps of this process, and the many, many options that are available. It is not clear to me how to get the various steps put together and get it to work. FYI, I've bene using digital filters in different computing languages for decades, so I think if I can't figure it out... at least some other users are probably having challenges as well. I understand that digital filters are complicated, and that there is a whole field of work regarding the choices regarding parameters, filter type, etc. That said, like many users, I just need to be able to create a basic filter (bandpass in my case) 'that works'. From there, I'd be in a position to start optimizing. At the moment, all I'm getting is arrays of NaNs as filter output (after several hours of work, and trying to copy the parameters in the readme). I've now started trying to install and understand all your testing machinery and how to use it as an example, but that's it's own whole little reverse-engineering project.
Below is one version of the (apparently incorrect) code that I've been trying to get to work.
BTW, it isn't clear to me which of the various filter functions I'm to use. multiStep? filtfilt? response? I guess it's obvious what these mean to you, but they're not documented, and they're certainly not clear to me. I've been trying all of them and trying to work out what they are/what they do.

Thank you.

@markert
Copy link
Owner

markert commented Feb 23, 2019

There is a demo implementation in the branch gh-pages that basically does what you would like to do. It is the code for the implementation of the demo page. You can configure an FIR or IIR filter and run it in single steps. multiStep is like singleStep just with an array as input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants