Builds a data structure that contains precalculated data for use by the single-precision cascaded biquad IIR filter function vDSP_biquad(_:_:_:_:_:_:_:).


func vDSP_biquad_CreateSetup(_ __Coefficients: UnsafePointer<Double>, _ __M: vDSP_Length) -> vDSP_biquad_Setup?



Input array of double-precision filter coefficients. Its length should be 5 times the number of sections in the biquad filter.


Number of sections in the biquad filter.

Return Value

Pointer to the setup object, of type vDSP_biquad_Setup.


This function constructs and returns a biquad IIR filter object from the coefficients specified by the array pointed to by Coefficients. It initializes the internal state of the setup object such that all delay elements used are set to zero.

This array of coefficients is laid out by section. Each set of 5 coefficients specific to a given section is specified with the 3 feedforward coefficients first, followed by the 2 feedback coefficients.

For example, the array could be constructed as follows (b0, b1, b2 are the feedforward coefficients and a1 and a2 are the feedback coefficients such that the difference equation relating the input x[n] to the output y[n] could be expressed as y[n] = b0*x[n] + b1*x[n-1] + b2*x[n-2] - a1*y[n-1] - a2*y[n-2] as shown in the pseudocode below:

for (vDSP_Length i = 0; i < sections; i++)
  coefficients[i*5 + 0] = (float)b0_for_section_i;
  coefficients[i*5 + 1] = (float)b1_for_section_i;
  coefficients[i*5 + 2] = (float)b2_for_section_i;
  coefficients[i*5 + 3] = (float)a1_for_section_i;
  coefficients[i*5 + 4] = (float)a2_for_section_i;

This function allocates memory for its own use; the allocated memory can be freed by the vDSP_biquad_DestroySetup(_:) function.

See Also

Creating a Single-Channel Biquadratic IIR Setup

func vDSP_biquad_CreateSetupD(UnsafePointer<Double>, vDSP_Length) -> vDSP_biquad_SetupD?

Builds a data structure that contains precalculated data for use by double-precision cascaded biquad IIR filter functions.