MATLAB Answers

How do I cascade biquad filters (dsp.BiquadFilter)?

27 views (last 30 days)
Hello everyone,
I want to cascade twelve biquad filters and apply the result to an audio signal.
My problem is that I have twelve frequencies that I want to boost on an audio signal.
My solution would be to use a biquad filter in MATLAB with the dsp.biquad object. I use the designParamEQ function for a parametric equalizer design, so that I'm able to set the gain, bandwidth, filter order and frequency. See the code below from this example.
Fs = 48e3;
N1 = 2;
G = 5; % 5 dB
Wo = 10000/(Fs/2);
BW = 4000/(Fs/2);
[B1,A1] = designParamEQ(N1,G,Wo,BW);
BQ1 = dsp.BiquadFilter('SOSMatrix',[B1.',[1,A1.']]);
Cascading twelve biquad filters with the dfilt.cascade function does not work. Cascades must be made of discrete-time filter (DFILT) objects and I currently use dsp.BiquadFilter objects.
Is there a way to design a biquad filter with the dsp.BiquadFilter object that is able to boost twelve frequency coefficients? If yes, how do I do this?
By the way, I don't want to change the bandwidth for each frequency. There should be one bandwidth variable and one gain variable with decreasing amplitude for all the frequency coefficients.
How do I apply my biquad filter to an audio signal? Which function should I use?
Is there a better solution than to use a parametric equalizer design?
I can't find any help on this in the MATLAB documentation.
Thanks in advance,
Patrick

  0 Comments

Sign in to comment.

Accepted Answer

jibrahim
jibrahim on 2 Nov 2020
Hi Patrick,
You can use dsp.FilterCascade to cascade dsp.BiquadFilter objects

  3 Comments

Patrick Boettcher
Patrick Boettcher on 2 Nov 2020
Thanks!
However, if I use a filter function MATLAB tells me that there are not enough input arguments. I only have two, the cascaded filter and the signal that I want to apply the filter on. I get the following error message:
% Error using filter
% Not enough input arguments.
% Error in Prototype (line 153)
y = filter(CascadedBiquads,out);
What do I need to change to apply my cascaded biquad filters to a signal?
jibrahim
jibrahim on 2 Nov 2020
Hi Patrick,
filter is not a supported command for dsp.FIlterCascade.
This is how you should call the object:
y = CascadedBiquads(out);

Sign in to comment.

More Answers (0)

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!