Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Examples  

MJ_FilterIIR2 Class Template Reference

#include <mj_filter_iir2.h>

List of all members.

Public Methods

 MJ_FilterIIR2 ()
 ~MJ_FilterIIR2 ()
 Empty destructor.

complex<float> response (complex< float > omega)
Filter usage:
void putSample (TElem s)
TElem getSample () const
TElem putGetSample (TElem s)
TElem putGetSampleOther (MJ_FilterIIR2 *f, TElem s)
void resetMemory ()
 Clear internal buffer.

Filter design methods:
void flatResponse ()
void designHighShelve1 (TElem centerRad, TElem gainDb, TElem slope=1.0)
void designHighShelve2 (TElem frequencyHz, TElem sampleRate, TElem gainDb, TElem slope=1.0)
void designLowShelve1 (TElem centerRad, TElem gainDb, TElem slope=1.0)
void designLowShelve2 (TElem frequencyHz, TElem sampleRate, TElem gainDb, TElem slope=1.0)
void designParametric1 (TElem boostAbs, TElem centerRad, TElem bandWidthRad)
void designParametricB1 (TElem K, TElem F, TElem omega, TElem bw)
void designParametricB2 (TElem hz, TElem sr, TElem gainDb, TElem bw)
void designParametricC1 (TElem K, TElem F, TElem omega, TElem bw)
void designParametricC2 (TElem hz, TElem sr, TElem gainDb, TElem bw)
void designLowPass1 (TElem omega, TElem Q)
 Design a low-pass filter.

void designLowPass2 (TElem hz, TElem sr, TElem Q)
 Design a low-pass filter. More...

void designHighPass1 (TElem omega, TElem Q)
 Design a high-pass filter.

void designHighPass2 (TElem hz, TElem sr, TElem Q)
 Design a high-pass filter. More...

void designBandPass1 (TElem omega, TElem Q)
 Design a band-pass filter. More...

void designBandPass2 (TElem hz, TElem sr, TElem Q)
 Design a band-pass filter. More...

void designBandPassB1 (TElem omega, TElem bw)
 Design a band-pass filter. More...

void designBandPassB2 (TElem hz, TElem sr, TElem bw)
 Design a band-pass filter. More...

void copyCoefficients (const MJ_FilterIIR2 &iir)
 Copy filter coefficients from the given filter.

void mulGain (TElem scale)
 Multiply b-coefficients by factor scale.

Filter coefficient access:
TElem b0 () const
 Filter coefficient b0.

TElem b1 () const
 Filter coefficient b1.

TElem b2 () const
 Filter coefficient b2.

TElem* bptr ()
 Returns pointer to the b-coefficient array (b0-b2).

TElem a1 () const
 Filter coefficient a1.

TElem a2 () const
 Filter coefficient a2.

TElem* aptr ()
 Returns pointer to the a-coefficient array (a1-a2).


Detailed Description

template<class TElem> class MJ_FilterIIR2

Linear second order IIR filter. Rather optimized.

The filter coefficients are normalized like in Matlab - the coefficient a0 is assumed to be 1. As such it not stored or used in calculation.

See also:
MJ_FilterDFII MJ_FilterAllPole1
Author:
Tommi Ilmonen


Constructor & Destructor Documentation

template<class TElem>
MJ_FilterIIR2<TElem>::MJ_FilterIIR2<TElem> ( ) [inline]
 

Empty constructor. Constructor does not initialize any values.


Member Function Documentation

template<class TElem>
void MJ_FilterIIR2<TElem>::designBandPass1 ( TElem omega,
TElem Q ) [inline]
 

Design a band-pass filter.

Parameters:
omega   Center frequency (radians)
Q   Q-value

template<class TElem>
void MJ_FilterIIR2<TElem>::designBandPass2 ( TElem hz,
TElem sr,
TElem Q ) [inline]
 

Design a band-pass filter.

Parameters:
hz   Center frequency (Hz)
sr   Sampling rate (Hz)
Q   Q-calue

template<class TElem>
void MJ_FilterIIR2<TElem>::designBandPassB1 ( TElem omega,
TElem bw ) [inline]
 

Design a band-pass filter.

Parameters:
omega   Center frequency (radians)
bw   Bandwidth

template<class TElem>
void MJ_FilterIIR2<TElem>::designBandPassB2 ( TElem hz,
TElem sr,
TElem bw ) [inline]
 

Design a band-pass filter.

Parameters:
hz   Center frequency (Hz)
sr   Sampling rate (Hz)
bw   Bandwidth

template<class TElem>
void MJ_FilterIIR2<TElem>::designHighPass2 ( TElem hz,
TElem sr,
TElem Q ) [inline]
 

Design a high-pass filter.

Parameters:
hz   Cut-off frequency (Hz)
sr   Sampling rate (Hz)

template<class TElem>
void MJ_FilterIIR2<TElem>::designHighShelve1 ( TElem centerRad,
TElem gainDb,
TElem slope = 1.0 ) [inline]
 

Design a high-shelving EQ. See MJ_dspHighShelveEq.

template<class TElem>
void MJ_FilterIIR2<TElem>::designHighShelve2 ( TElem frequencyHz,
TElem sampleRate,
TElem gainDb,
TElem slope = 1.0 ) [inline]
 

Design a high-shelving EQ. See iir2HighShelveEq.

template<class TElem>
void MJ_FilterIIR2<TElem>::designLowPass2 ( TElem hz,
TElem sr,
TElem Q ) [inline]
 

Design a low-pass filter.

Parameters:
hz   Cut-off frequency (Hz)
sr   Sampling rate (Hz)

template<class TElem>
void MJ_FilterIIR2<TElem>::designLowShelve1 ( TElem centerRad,
TElem gainDb,
TElem slope = 1.0 ) [inline]
 

Design a high-shelving EQ. See iir2LowShelveEq.

template<class TElem>
void MJ_FilterIIR2<TElem>::designLowShelve2 ( TElem frequencyHz,
TElem sampleRate,
TElem gainDb,
TElem slope = 1.0 ) [inline]
 

Design a high-shelving EQ. See iir2LowShelveEq.

template<class TElem>
void MJ_FilterIIR2<TElem>::designParametric1 ( TElem boostAbs,
TElem centerRad,
TElem bandWidthRad )
 

Design a parametric EQ. This algorithm is not too flashy. It often creates numerically unstable filters. I have not removed this method since it may be of some use to someone...

template<class TElem>
void MJ_FilterIIR2<TElem>::designParametricB1 ( TElem K,
TElem F,
TElem omega,
TElem bw ) [inline]
 

Design a parametric EQ. The algorithm is fairly ok.

template<class TElem>
void MJ_FilterIIR2<TElem>::designParametricB2 ( TElem hz,
TElem sr,
TElem gainDb,
TElem bw ) [inline]
 

Parameters:
hz   Center frequency (Hz)
sr   Sampling rate (Hz)
gainDb   Gain (decibels)
bw   Bandwidth (octaves)

template<class TElem>
void MJ_FilterIIR2<TElem>::designParametricC1 ( TElem K,
TElem F,
TElem omega,
TElem bw ) [inline]
 

Design a parameteric filter that mimics analogue filters.

Algorithm by S. J. Orfanidis: "Digital Parametric Equalizer Design with Prescribed Nyquist Frequency Gain", J. Audio Eng. Soc., vol.45, p.444, June 1997.

The algorithm creates fairly ok frequency responses in most cases. The unfortunate exception: When the filter center frequency is high and the filter bandwidth is great the designed filter often has a rather poor curve shape.

Parameters:
K   Center gain
F   Bandwidth gain
omega   Band center radians/sample
bw   Bandwidth in octaves

template<class TElem>
void MJ_FilterIIR2<TElem>::designParametricC2 ( TElem hz,
TElem sr,
TElem gainDb,
TElem bw ) [inline]
 

Design a parameteric filter that mimics analogue filters. This is a utility method that uses designParametricC1 to do the dirty work.

Parameters:
hz   Center frequency (Hz)
sr   Sampling rate (Hz)
gainDb   Gain (decibels)
bw   Bandwidth (octaves)

template<class TElem>
void MJ_FilterIIR2<TElem>::flatResponse ( ) [inline]
 

Makes the filter have flat frequency response.

template<class TElem>
TElem MJ_FilterIIR2<TElem>::getSample ( ) const [inline]
 

Get the current sample. Does not change the filter state, but causes computation.

template<class TElem>
TElem MJ_FilterIIR2<TElem>::putGetSample ( TElem s ) [inline]
 

Put sample and get output sample.

template<class TElem>
TElem MJ_FilterIIR2<TElem>::putGetSampleOther ( MJ_FilterIIR2<TElem> * f,
TElem s ) [inline]
 

Put sample and get output sample on a foreign filter. The filter coeeficients of "this" filter are used on the memory of the other filter.

template<class TElem>
void MJ_FilterIIR2<TElem>::putSample ( TElem s ) [inline]
 

Puts a sample to the filter. Changes the internal state, but does not calculate the output value.

template<class TElem>
complex< float > MJ_FilterIIR2<TElem>::response ( complex< float > omega ) [inline]
 

Compute z-domain response.


The documentation for this class was generated from the following file:
Generated at Sun Jan 18 20:51:23 2004 for Jezabel by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001