#include <BandFilter.h>
Public Types | |
enum | FilterType { CHEBYSHEVI = 0, CHEBYSHEVII = 1, BUTTERWORTH = 2, BESSEL = 3 } |
Specifies the type of the filter. More... | |
enum | BandType { LOWPASS = 0, HIGHPASS = 1, BANDPASS = 2, BANDSTOP = 3 } |
Specifies the type of the band. More... | |
Public Member Functions | |
BandFilter (int order=4, Real lowFrequency=0.0, Real highFrequency=1.0, BandType bandType=LOWPASS, FilterType filterType=CHEBYSHEVII, Real ripplePass=0.05, Real attenuationStop=40.0) | |
void | process (const MatrixXR &samples, MatrixXR *filtered) |
void | a (MatrixXR *a) const |
void | b (MatrixXR *b) const |
int | order () const |
void | setOrder (int order, bool callSetup=true) |
Real | lowFrequency () const |
void | setLowFrequency (Real frequency, bool callSetup=true) |
Real | highFrequency () const |
void | setHighFrequency (Real frequency, bool callSetup=true) |
FilterType | filterType () const |
void | setFilterType (FilterType type, bool callSetup=true) |
BandType | bandType () const |
void | setBandType (BandType type, bool callSetup=true) |
Real | passRipple () const |
void | setPassRipple (Real rippleDB, bool callSetup=true) |
Real | stopAttenuation () const |
void | setStopAttenuation (Real attenuationDB, bool callSetup=true) |
This class represents an object to create and apply several types of band filters. Additionally the coefficients, zeros, poles and gains of the created filters can be retrieved.
4 types of bands are implemented:
The band type can be selected using the setBandType() taking as argument a BandType.
The critical frequencies are specified using setLowFrequency() and setHighFrequency(). Note that for low pass and high pass filters which have one single critical frequency only setLowFrequency() has an effect.
4 types of filters are implemented:
The filter type can be selected using the setFilterType() taking as argument a FilterType.
The order of the filters can be specified using setOrder().
For Chebyshev I filters the pass band ripple can be specified using setPassRipple(). Note that this method has no effect if a different type of filter is used.
For Chebyshev II filters the stop band attenuation is specified using setStopAttenuation(). Note that this method has no effect if a different type of filter is used.
enum FilterType |
BandFilter | ( | int | order = 4 , |
|
Real | lowFrequency = 0.0 , |
|||
Real | highFrequency = 1.0 , |
|||
BandType | bandType = LOWPASS , |
|||
FilterType | filterType = CHEBYSHEVII , |
|||
Real | ripplePass = 0.05 , |
|||
Real | attenuationStop = 40.0 | |||
) |
Constructs a band pass filter object with the given order, lowFrequency, highFrequency, filterType, ripplePass and attenuationStop parameters given.
References setBandType(), setFilterType(), setHighFrequency(), setLowFrequency(), setOrder(), setPassRipple(), and setStopAttenuation().
void process | ( | const MatrixXR & | samples, | |
MatrixXR * | filtered | |||
) |
Performs a filtering of each of the columns of samples. Puts the resulting filtered in the columns of filtered.
samples | matrix of Real values. A column represents a channel and a row represents a time index. | |
filtered | pointer to a matrix of Real values for the output. The matrix should have the same number of rows and columns as samples. |
References Filter::process().
void a | ( | MatrixXR * | a | ) | const |
void b | ( | MatrixXR * | b | ) | const |
int order | ( | ) | const |
void setOrder | ( | int | order, | |
bool | callSetup = true | |||
) |
Specifies the order of the filter. The given order must be higher than 0. Note that orders higher than 25 are not allowed for Bessel filters.
Referenced by BandFilter().
Real lowFrequency | ( | ) | const |
Return the low frequency of the filter. The default is 0.0.
void setLowFrequency | ( | Real | frequency, | |
bool | callSetup = true | |||
) |
Specifies the low normalized frequency of the filter. The given frequency must be in the range of 0 to 1.
Referenced by BandFilter().
Real highFrequency | ( | ) | const |
Return the stop frequency of the filter. The default is 1.0.
void setHighFrequency | ( | Real | frequency, | |
bool | callSetup = true | |||
) |
Specifies the stop normalized frequency of the filter. The given frequency must be in the range of 0 to 1.
Referenced by BandFilter().
BandFilter::FilterType filterType | ( | ) | const |
Return the filter type. The default is CHEBYSHEVII. The given frequency must be in the range of 0 to 1.
void setFilterType | ( | FilterType | type, | |
bool | callSetup = true | |||
) |
Specifies the filter type.
Referenced by BandFilter().
BandFilter::BandType bandType | ( | ) | const |
void setBandType | ( | BandType | type, | |
bool | callSetup = true | |||
) |
Real passRipple | ( | ) | const |
Returns the ripple of the pass band in dB
Note that this property only has an effect if the filter type used is CHEBYSHEVI. By default it is 0.05.
void setPassRipple | ( | Real | rippleDB, | |
bool | callSetup = true | |||
) |
Specifies the ripple of the pass band in dB
Note that this property only has an effect if the filter type used is CHEBYSHEVI.
Referenced by BandFilter().
Real stopAttenuation | ( | ) | const |
Returns the attenuation of the stop band in dB
Note that this property only has an effect if the filter type used is CHEBYSHEVII. By default it is 40.0.
void setStopAttenuation | ( | Real | attenuationDB, | |
bool | callSetup = true | |||
) |
Specifies the attenuation of the stop band in dB
Note that this property only has an effect if the filter type used is CHEBYSHEVII.
Referenced by BandFilter().