Cascaded Biquads#

Cascaded biquad Stages consist of several biquad filters connected together in series.

class audio_dsp.stages.cascaded_biquads.CascadedBiquads(**kwargs)

8 cascaded biquad filters. This allows up to 8 second order biquad filters to be run in series.

This can be used for either:

  • an Nth order filter built out of cascaded second order sections

  • a parametric EQ, where several biquad filters are used at once.

For documentation on the individual biquad filters, see audio_dsp.stages.biquad.Biquad and audio_dsp.dsp.biquad.biquad

Attributes:
dsp_blockaudio_dsp.dsp.cascaded_biquad.cascaded_biquad

The DSP block class; see Cascaded Biquads for implementation details.

make_butterworth_highpass(N: int, fc: float) CascadedBiquads

Configure this instance as an Nth order Butterworth highpass filter using N/2 cascaded biquads.

For details on the implementation, see audio_dsp.dsp.cascaded_biquads.make_butterworth_highpass

Parameters:
Nint

Filter order, must be even

fcfloat

-3 dB frequency in Hz.

make_butterworth_lowpass(N: int, fc: float) CascadedBiquads

Configure this instance as an Nth order Butterworth lowpass filter using N/2 cascaded biquads.

For details on the implementation, see audio_dsp.dsp.cascaded_biquads.make_butterworth_lowpass

Parameters:
Nint

Filter order, must be even

fcfloat

-3 dB frequency in Hz.

make_parametric_eq(filter_spec: list[list[Any]]) CascadedBiquads

Configure this instance as a Parametric Equaliser.

This allows each of the 8 biquads to be individually designed using the designer methods for the biquad. This expects to receive a list of up to 8 biquad design descriptions where a biquad design description is of the form:

["type", args...]

where “type” is a string defining how the biquad should be designed e.g. “lowpass”, and args… is all the parameters to design that type of filter. All options and arguments are listed below:

["biquad_allpass", filter_freq, q_factor, Q_sig]
["biquad_bandpass", filter_freq, bw, Q_sig]
["biquad_bandstop", filter_freq, bw, Q_sig]
["biquad_bypass", Q_sig]
["biquad_constant_q", filter_freq, q_factor, boost_db, Q_sig]
["biquad_gain", gain_db, Q_sig]
["biquad_highpass", filter_freq, q_factor, Q_sig]
["biquad_highshelf", filter_freq, q_factor, boost_db, Q_sig]
["biquad_linkwitz", f0, q0, fp, qp, Q_sig]
["biquad_lowpass", filter_freq, q_factor, Q_sig]
["biquad_lowshelf", filter_freq, q_factor, boost_db, Q_sig]
["biquad_notch", filter_freq, q_factor, Q_sig]
["biquad_peaking", filter_freq, q_factor, boost_db, Q_sig]

CascadedBiquads Control#

The following runtime command ids are available for the CascadedBiquads Stage. For details on reading and writing these commands, see the Run-Time Control User Guide.

Control parameter

Payload length

CMD_CASCADED_BIQUADS_LEFT_SHIFT

sizeof(int)*[8]

The coefficient shift applied to the output of each biquad in the cascade. The shifts should be in the same format as specified in the individual biquad.


CMD_CASCADED_BIQUADS_FILTER_COEFFS

sizeof(int32_t)*[40]

The normalised biquad filter coefficients for each biquad in the cascade as an array of [5][8], with 5 coefficients for up to 8 biquads. The coefficients should be in the same format as specified in the individual biquad.