Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
Toggle table of contents sidebar

# Cascaded Biquads Stages

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

## CascadedBiquads

class audio_dsp.stages.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_block `audio_dsp.dsp.cascaded_biquad.cascaded_biquad`

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

  make_butterworth_highpass(N: int, fc: float)

    Configure this CascadedBiquads 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:
      N int

        The order of the filter. Must be even and less than 16.

      fc float

        The -3dB cutoff frequency in Hz.

  make_butterworth_lowpass(N: int, fc: float)

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

    Parameters:
      N int

        The order of the filter. Must be even and less than 16.

      fc float

        The -3dB cutoff frequency in Hz.

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

    Configure this CascadedBiquads instance as a Parametric Equaliser based on new parameters.

    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.

    Parameters:
      filter_spec list[list[Any]]

        A list of lists, each inner list contains the parameters for a single biquad filter. The first element of each inner list is the filter type, the remaining elements are the parameters for that filter type. The available filter types and their parameters are:

        [“allpass”, filter_freq, q_factor]
        [“bandpass”, filter_freq, BW]
        [“bandstop”, filter_freq, BW]
        [“bypass”]
        [“constant_q”, filter_freq, q_factor, boost_db]
        [“gain”, gain_db]
        [“highpass”, filter_freq, q_factor]
        [“highshelf”, filter_freq, q_factor, gain_db]
        [“linkwitz”, f0, q0, fp, qp]
        [“lowpass”, filter_freq, q_factor]
        [“lowshelf”, filter_freq, q_factor, gain_db]
        [“mute”]
        [“notch”, filter_freq, q_factor]
        [“peaking”, filter_freq, q_factor, boost_db]
  set_parameters(
    parameters: CascadedBiquadsParameters | NthOrderFilterParameters,
  )

    Update the parameters of the CascadedBiquads stage.

    Parameters:
      parameters CascadedBiquadsParameters | NthOrderFilterParameters

        The parameters to update the cascaded biquads with.

pydantic model audio_dsp.models.cascaded_biquads.CascadedBiquadsParameters

  Parameters for CascadedBiquad Stage.

  Attributes:
    filters list[BIQUAD_TYPES]

      A list of BiquadParameters to update the cascaded biquads with.

  field filters: Annotated[list[biquad_allpass | biquad_bandpass | biquad_bandstop | biquad_bypass | biquad_constant_q | biquad_gain | biquad_highpass | biquad_highshelf | biquad_linkwitz | biquad_lowpass | biquad_lowshelf | biquad_mute | biquad_notch | biquad_peaking], Len(min_length=8, max_length=None)] [Optional]
    Constraints:

      - max_length = 8

      - min_length = 8

pydantic model audio_dsp.models.cascaded_biquads.NthOrderFilterParameters

  Parameters for NthOrderFilter Stage.

  field filter: Literal['butterworth'] = 'butterworth'

    Class of filter to use. Currently only ‘butterworth’ is supported.

  field filter_freq: float = 1000

    -3dB cutoff frequency of the filter in Hz.

    Constraints:

      - gt = 0

      - lt = 24000

  field order: Literal[2, 4, 6, 8, 10, 12, 14, 16] = 2

    The order of the filter. Must be even and less than 16.

  field type: Literal['bypass', 'highpass', 'lowpass'] = 'bypass'

    Type of filter to implement. Can be ‘bypass’, ‘highpass’, or ‘lowpass’.

### 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 [8][5], with 5 coefficients for up to 8 biquads. The coefficients should be in the same format as specified in the individual biquad. See Biquad helpers. |

## CascadedBiquads16

class audio_dsp.stages.CascadedBiquads16(**kwargs)

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

  This can be used for:

  - 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_block `audio_dsp.dsp.cascaded_biquad.cascaded_biquad_16`

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

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

    Configure this CascadedBiquads16 instance as a Parametric Equaliser based on new parameters.

    This allows each of the 16 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.

    Parameters:
      filter_spec list[list[Any]]

        A list of lists, each inner list contains the parameters for a single biquad filter. The first element of each inner list is the filter type, the remaining elements are the parameters for that filter type. The available filter types and their parameters are:

        [“allpass”, filter_freq, q_factor]
        [“bandpass”, filter_freq, BW]
        [“bandstop”, filter_freq, BW]
        [“bypass”]
        [“constant_q”, filter_freq, q_factor, boost_db]
        [“gain”, gain_db]
        [“highpass”, filter_freq, q_factor]
        [“highshelf”, filter_freq, q_factor, gain_db]
        [“linkwitz”, f0, q0, fp, qp]
        [“lowpass”, filter_freq, q_factor]
        [“lowshelf”, filter_freq, q_factor, gain_db]
        [“mute”]
        [“notch”, filter_freq, q_factor]
        [“peaking”, filter_freq, q_factor, boost_db]
  set_parameters(
    parameters: CascadedBiquads16Parameters,
  )

    Update the parameters of the CascadedBiquads16 stage.

    Parameters:
      parameters CascadedBiquads16Parameters

        The parameters to update the cascaded biquads with.

pydantic model audio_dsp.models.cascaded_biquads.CascadedBiquads16Parameters

  Parameters for CascadedBiquad16 Stage.

  field filters: Annotated[list[biquad_allpass | biquad_bandpass | biquad_bandstop | biquad_bypass | biquad_constant_q | biquad_gain | biquad_highpass | biquad_highshelf | biquad_linkwitz | biquad_lowpass | biquad_lowshelf | biquad_mute | biquad_notch | biquad_peaking], Len(min_length=16, max_length=None)] [Optional]
    Constraints:

      - max_length = 16

      - min_length = 16

### CascadedBiquads16 Control

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

Control parameter | Payload length
--- | ---
CMD_CASCADED_BIQUADS16_LEFT_SHIFT | `sizeof(int)*[16]`
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_BIQUADS16_FILTER_COEFFS_LOWER | `sizeof(int32_t)*[40]`
The normalised biquad filter coefficients for the first 8 biquads in the cascade as an array of [8][5], with 5 coefficients for 8 biquads. The coefficients should be in the same format as specified in the individual biquad. See Biquad helpers. |
CMD_CASCADED_BIQUADS16_FILTER_COEFFS_UPPER | `sizeof(int32_t)*[40]`
The normalised biquad filter coefficients for the last 8 biquads in the cascade as an array of [8][5], with 5 coefficients for up to 8 biquads. The coefficients should be in the same format as specified in the individual biquad. See Biquad helpers. |

## ParametricEq8b

class audio_dsp.stages.ParametricEq8b(**kwargs)

  An 8 band parametric equalizer stage. This stage allows up to 8 biquad filters to be run in series. Each filter can be configured independently.

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

  Attributes:
    dsp_block `audio_dsp.dsp.cascaded_biquad.cascaded_biquad`

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

  make_butterworth_highpass(N: int, fc: float)

    Configure this CascadedBiquads 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:
      N int

        The order of the filter. Must be even and less than 16.

      fc float

        The -3dB cutoff frequency in Hz.

  make_butterworth_lowpass(N: int, fc: float)

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

    Parameters:
      N int

        The order of the filter. Must be even and less than 16.

      fc float

        The -3dB cutoff frequency in Hz.

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

    Configure this CascadedBiquads instance as a Parametric Equaliser based on new parameters.

    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.

    Parameters:
      filter_spec list[list[Any]]

        A list of lists, each inner list contains the parameters for a single biquad filter. The first element of each inner list is the filter type, the remaining elements are the parameters for that filter type. The available filter types and their parameters are:

        [“allpass”, filter_freq, q_factor]
        [“bandpass”, filter_freq, BW]
        [“bandstop”, filter_freq, BW]
        [“bypass”]
        [“constant_q”, filter_freq, q_factor, boost_db]
        [“gain”, gain_db]
        [“highpass”, filter_freq, q_factor]
        [“highshelf”, filter_freq, q_factor, gain_db]
        [“linkwitz”, f0, q0, fp, qp]
        [“lowpass”, filter_freq, q_factor]
        [“lowshelf”, filter_freq, q_factor, gain_db]
        [“mute”]
        [“notch”, filter_freq, q_factor]
        [“peaking”, filter_freq, q_factor, boost_db]
  set_parameters(
    parameters: CascadedBiquadsParameters,
  )

    Update the parameters of the ParametricEq8b stage.

    Parameters:
      parameters CascadedBiquadsParameter

        A list of BiquadParameters to update the cascaded biquads with.

pydantic model audio_dsp.models.cascaded_biquads.CascadedBiquadsParameters

  Parameters for CascadedBiquad Stage.

  Attributes:
    filters list[BIQUAD_TYPES]

      A list of BiquadParameters to update the cascaded biquads with.

  field filters: Annotated[list[biquad_allpass | biquad_bandpass | biquad_bandstop | biquad_bypass | biquad_constant_q | biquad_gain | biquad_highpass | biquad_highshelf | biquad_linkwitz | biquad_lowpass | biquad_lowshelf | biquad_mute | biquad_notch | biquad_peaking], Len(min_length=8, max_length=None)] [Optional]
    Constraints:

      - max_length = 8

      - min_length = 8

### ParametricEq8b Control

The ParametricEq8b Stage has no runtime controllable parameters.

## ParametricEq16b

class audio_dsp.stages.ParametricEq16b(**kwargs)

  A 16 band parametric equalizer stage. This stage allows up to 16 biquad filters to be run in series. Each filter can be configured independently.

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

  Attributes:
    dsp_block `audio_dsp.dsp.cascaded_biquad.cascaded_biquad_16`

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

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

    Configure this CascadedBiquads16 instance as a Parametric Equaliser based on new parameters.

    This allows each of the 16 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.

    Parameters:
      filter_spec list[list[Any]]

        A list of lists, each inner list contains the parameters for a single biquad filter. The first element of each inner list is the filter type, the remaining elements are the parameters for that filter type. The available filter types and their parameters are:

        [“allpass”, filter_freq, q_factor]
        [“bandpass”, filter_freq, BW]
        [“bandstop”, filter_freq, BW]
        [“bypass”]
        [“constant_q”, filter_freq, q_factor, boost_db]
        [“gain”, gain_db]
        [“highpass”, filter_freq, q_factor]
        [“highshelf”, filter_freq, q_factor, gain_db]
        [“linkwitz”, f0, q0, fp, qp]
        [“lowpass”, filter_freq, q_factor]
        [“lowshelf”, filter_freq, q_factor, gain_db]
        [“mute”]
        [“notch”, filter_freq, q_factor]
        [“peaking”, filter_freq, q_factor, boost_db]
  set_parameters(
    parameters: CascadedBiquads16Parameters,
  )

    Update the parameters of the ParametricEq16b stage.

pydantic model audio_dsp.models.cascaded_biquads.CascadedBiquads16Parameters

  Parameters for CascadedBiquad16 Stage.

  field filters: Annotated[list[biquad_allpass | biquad_bandpass | biquad_bandstop | biquad_bypass | biquad_constant_q | biquad_gain | biquad_highpass | biquad_highshelf | biquad_linkwitz | biquad_lowpass | biquad_lowshelf | biquad_mute | biquad_notch | biquad_peaking], Len(min_length=16, max_length=None)] [Optional]
    Constraints:

      - max_length = 16

      - min_length = 16

### ParametricEq16b Control

The ParametricEq16b Stage has no runtime controllable parameters.

## NthOrderFilter

class audio_dsp.stages.NthOrderFilter(**kwargs)

  An Nth order filter stage. This stage allows up a 16th order filter to be created by cascading 8 second order biquad filters.

  Attributes:
    dsp_block `audio_dsp.dsp.cascaded_biquad.cascaded_biquad`

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

  make_butterworth_highpass(N: int, fc: float)

    Configure this CascadedBiquads 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:
      N int

        The order of the filter. Must be even and less than 16.

      fc float

        The -3dB cutoff frequency in Hz.

  make_butterworth_lowpass(N: int, fc: float)

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

    Parameters:
      N int

        The order of the filter. Must be even and less than 16.

      fc float

        The -3dB cutoff frequency in Hz.

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

    Configure this CascadedBiquads instance as a Parametric Equaliser based on new parameters.

    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.

    Parameters:
      filter_spec list[list[Any]]

        A list of lists, each inner list contains the parameters for a single biquad filter. The first element of each inner list is the filter type, the remaining elements are the parameters for that filter type. The available filter types and their parameters are:

        [“allpass”, filter_freq, q_factor]
        [“bandpass”, filter_freq, BW]
        [“bandstop”, filter_freq, BW]
        [“bypass”]
        [“constant_q”, filter_freq, q_factor, boost_db]
        [“gain”, gain_db]
        [“highpass”, filter_freq, q_factor]
        [“highshelf”, filter_freq, q_factor, gain_db]
        [“linkwitz”, f0, q0, fp, qp]
        [“lowpass”, filter_freq, q_factor]
        [“lowshelf”, filter_freq, q_factor, gain_db]
        [“mute”]
        [“notch”, filter_freq, q_factor]
        [“peaking”, filter_freq, q_factor, boost_db]
  set_parameters(
    parameters: NthOrderFilterParameters,
  )

    Update the parameters of the NthOrderFilter stage.

    Parameters:
      parameters NthOrderFilter

        The parameters to update the Nth order filter with.

pydantic model audio_dsp.models.cascaded_biquads.NthOrderFilterParameters

  Parameters for NthOrderFilter Stage.

  field filter: Literal['butterworth'] = 'butterworth'

    Class of filter to use. Currently only ‘butterworth’ is supported.

  field filter_freq: float = 1000

    -3dB cutoff frequency of the filter in Hz.

    Constraints:

      - gt = 0

      - lt = 24000

  field order: Literal[2, 4, 6, 8, 10, 12, 14, 16] = 2

    The order of the filter. Must be even and less than 16.

  field type: Literal['bypass', 'highpass', 'lowpass'] = 'bypass'

    Type of filter to implement. Can be ‘bypass’, ‘highpass’, or ‘lowpass’.

### NthOrderFilter Control

The NthOrderFilter Stage has no runtime controllable parameters.