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

Add filtering support and subcrate #148

Open
wants to merge 25 commits into
base: master
Choose a base branch
from

Conversation

linclelinkpart5
Copy link
Contributor

@linclelinkpart5 linclelinkpart5 commented Jan 15, 2021

Closes #145

Adds a new subcrate dasp_filter, which includes Coefficients and Biquad types. This crate uses the same feature gating as the other crates in dasp.

In addition, similar to how envelope is a subfeature in dasp_signal, I also added filter as a subfeature. This involves adding feature flags for the dasp_signal subcrate, plus an extension trait (SignalFilter) and iterator type (FilteredSignal) in dasp_signal, both of which are feature-gated.

@linclelinkpart5 linclelinkpart5 changed the title #145 Add filtering support and subcrate Jan 15, 2021
@mitchmindtree
Copy link
Member

mitchmindtree commented Jan 17, 2021

Once again, great stuff @linclelinkpart5 - thanks for the PR!

I wonder if we should allow for alternatives to the BiQuad filter to be used too? Then again, we might be better off waiting until this is requested, at which point we can maybe add a Filter trait or something along these lines. I'm happy to merge this as is in the meantime.

Before we merge, could you update the action in .github/workflow to add a step for auto-publishing the dasp_filter crate? It makes it a bit easier for contributors to get new versions published, as we just have to merge a PR that changes the version.

Edit: Also if you could update the CHANGELOG that would be very helpful.

@linclelinkpart5
Copy link
Contributor Author

linclelinkpart5 commented Jan 18, 2021

@mitchmindtree Certainly! I'll go ahead and make the change to .github/workflow and update CHANGELOG. I'm assuming I can add the changes to the "Unreleased" section?

@linclelinkpart5
Copy link
Contributor Author

linclelinkpart5 commented Jan 18, 2021

As for the general concept of filtering, I need to do a bit more research to see what other kinds of useful types of digital filters there are. As far as I was able to tell, using biquads was the magic ticket: they're flexible enough to do single pole (or what I guess would be called "uniquad", but I've never come across that term) filters, and any filters of higher orders can be represented as a series of biquad filters. In fact, it's recommended!

A feature that I'd love to tackle once this lands in master would be to allow nicer constructors for the Coefficients struct. For instance, a constructor that given the correct args, will produce the coefficients for a highpass/lowpass/shelf/etc filter. All of these types can be represented in the biquad form.

@Adam-Gleave
Copy link

Are there any updates on this? Looks good 👀

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

Successfully merging this pull request may close these issues.

Adding biquad filtering to Signal
3 participants