Aviate Audio Multiverse Library
Public Member Functions | List of all members
Aviate::IirBiQuadFilter Class Reference

IIR BiQuad Filter - Direct Form I
y[n] = b0 * x[n] + b1 * x[n-1] + b2 * x[n-2] + a1 * y[n-1] + a2 * y[n-2]
Some design tools (like Matlab assume the feedback coefficients 'a' are negated. More...

#include <LibBasicFunctions.h>

Public Member Functions

 IirBiQuadFilter (unsigned numStages, const int32_t *coeffs, int coeffShift=0)
 Construct a Biquad filter with specified number of stages, coefficients and scaling. More...
 
virtual ~IirBiQuadFilter ()
 Destructor.
 
void changeFilterCoeffs (unsigned numStages, const int32_t *coeffs, int coeffShift=0)
 Reconfigure the filter coefficients. More...
 
bool process (int16_t *output, int16_t *input, size_t numSamples)
 Process the data using the configured IIR filter. More...
 

Detailed Description

IIR BiQuad Filter - Direct Form I
y[n] = b0 * x[n] + b1 * x[n-1] + b2 * x[n-2] + a1 * y[n-1] + a2 * y[n-2]
Some design tools (like Matlab assume the feedback coefficients 'a' are negated.

You may have to negate your 'a' coefficients.

Note that the ARM CMSIS-DSP library requires an extra zero between first and second 'b' coefficients. E.g.
{b10, 0, b11, b12, a11, a12, b20, 0, b21, b22, a21, a22, ...}

Constructor & Destructor Documentation

◆ IirBiQuadFilter()

Aviate::IirBiQuadFilter::IirBiQuadFilter ( unsigned  numStages,
const int32_t *  coeffs,
int  coeffShift = 0 
)

Construct a Biquad filter with specified number of stages, coefficients and scaling.

See CMSIS-DSP documentation for more details

Parameters
numStagesnumber of biquad stages. Each stage has 5 coefficients.
coeffspointer to an array of Q31 fixed-point coefficients (range -1 to +0.999...)
coeffShiftcoeffs are multiplied by 2^coeffShift to support coefficient range scaling

Member Function Documentation

◆ changeFilterCoeffs()

void Aviate::IirBiQuadFilter::changeFilterCoeffs ( unsigned  numStages,
const int32_t *  coeffs,
int  coeffShift = 0 
)

Reconfigure the filter coefficients.

See CMSIS-DSP documentation for more details

Parameters
numStagesnumber of biquad stages. Each stage has 5 coefficients.
coeffspointer to an array of Q31 fixed-point coefficients (range -1 to +0.999...)
coeffShiftcoeffs are multiplied by 2^coeffShift to support coefficient range scaling

◆ process()

bool Aviate::IirBiQuadFilter::process ( int16_t *  output,
int16_t *  input,
size_t  numSamples 
)

Process the data using the configured IIR filter.

output and input can be the same pointer if in-place modification is desired

Parameters
outputpointer to where the output results will be written
inputpointer to where the input data will be read from
numSamplesnumber of samples to process
Returns
true if successful, false if an error occurs

The documentation for this class was generated from the following file: