libiir
1.0.2

IIR filter coefficient set More...
Public Member Functions  
Filter (const Coeff &coeff)  
Construct from coefficient set.  
Filter (const Filter &other)  
Copy constructor.  
Filter (const char *desc)  
Construct from filter description string.  
virtual  ~Filter () 
Destructor.  
bool  valid () const 
Determine whether object is valid.  
double  f (double x) 
Filter a sample.  
int  numCoeffSet () const 
Retrieve number of coefficient sets.  
const Coeff &  getCoeffSet (int idx) const 
Retrieve coefficient set.  
void  chainCoeffSet (const Coeff &coeff) 
Add another set of coefficients to the filter chain.  
std::complex< double >  response (double freq) const 
Evaluate response of filter at given frequency.  
std::vector< double >  responseMinus3dB (double gain) const 
Search for 3dB points. 
IIR filter coefficient set
An instance of this class contains both a copy of the set of coefficients used in each filter stage (of which there may be multiple), and all of the state (i.e. previous inputs and outputs) associated with each stage.
IIR::Filter::Filter  (  const Coeff &  coeff  ) 
Construct from coefficient set.
coeff  Coefficient set. 
This constructor builds a filter chain with one stage. Additional stages may be added via chainCoeffSet(). This constructor will always result in a valid object.
IIR::Filter::Filter  (  const Filter &  other  ) 
Copy constructor.
other  Filter to copy. 
Copies the structure (but not the state) of the filter other. This constructor will always result in a valid object.
IIR::Filter::Filter  (  const char *  desc  ) 
Construct from filter description string.
desc  Description string. 
This constructor will parse the description string desc (see Describing IIR filters as strings for details on what is accepted) and build up a filter as described.
If the parsing step fails, then valid() will return false and the object must not be used (no other functions except the destructor will be safe to call).
bool IIR::Filter::valid  (  )  const 
Determine whether object is valid.
true  if object is valid. 
false  if object is not valid. 
A Filter object might not be valid if it was constructed from a description string that contained an error. In that case this function will return false and the object should not be used (no other functions except the destructor will be safe to call).
double IIR::Filter::f  (  double  x  ) 
Filter a sample.
x  Sample. 
Injects a single sample into the filter and returns the output value.
int IIR::Filter::numCoeffSet  (  )  const 
Retrieve number of coefficient sets.
const Coeff& IIR::Filter::getCoeffSet  (  int  idx  )  const 
Retrieve coefficient set.
idx  Index of set (0 ≤ idx < numCoeffSet()). 
void IIR::Filter::chainCoeffSet  (  const Coeff &  coeff  ) 
Add another set of coefficients to the filter chain.
coeff  Coefficient set to add. 
std::complex<double> IIR::Filter::response  (  double  freq  )  const 
Evaluate response of filter at given frequency.
freq  Frequency (0 ≤ freq ≤ 1). 
Returns the steadystate response of the filter to a pure input signal of the given frequency. freq is expressed as a fraction of the intended sampling rate (with 0.5 being the Nyquist frequency).
std::vector<double> IIR::Filter::responseMinus3dB  (  double  gain  )  const 
Search for 3dB points.
gain  Nominal gain of filter. 
This function will perform a linear scan of the frequency response of the filter between DC and the Nyquist frequency. It will then search for any pair of points between which the magnitude transitions the 3dB level. It then performs a few levels of binary search in order to provide a more accurate answer.
Returned frequencies are expressed as a fraction of the sampling rate.