Reputation: 914
I'm working to an app that needs to applying some DSP filters to data coming from sensors. I found the vDSP section of the Accelerate Framework, but the initialisers for the Biquad filter (that then you will apply) expects the a
and b
coefficients already calculated.
I have the cut-off frequency for the low-pass and high-pass filters and the band interval for the band-pass filter. How do you calculate the coefficients? Is there any specific library? Or does vDSP has some helpers that I wasn't able to find in the documentation?
Thanks
Upvotes: 0
Views: 751
Reputation: 70733
Here's one version of RBJ's canonical Biquad cookbook recipe to compute Biquad coefficients from a description of cutoff frequency and Q, for HP, LP and BP filters:
https://www.w3.org/2011/audio/audio-eq-cookbook.html
Many variants of C source code for RBJ's cookbook on GitHub, for instance:
https://github.com/wooters/miniDSP/blob/master/biquad.c
Should be easy to convert this to Swift.
Upvotes: 1