The Open Master Hearing Aid (openMHA)
openMHA
Open community platform for hearing aid algorithm research
|
Namespace for IIR and FIR filter classes. More...
Classes | |
class | complex_bandpass_t |
Complex bandpass filter. More... | |
class | gamma_flt_t |
Class for gammatone filter. More... | |
class | thirdoctave_analyzer_t |
class | filter_t |
Generic IIR filter class. More... | |
class | diff_t |
Differentiator class (non-normalized) More... | |
class | o1_ar_filter_t |
First order attack-release lowpass filter. More... | |
class | o1flt_lowpass_t |
First order low pass filter. More... | |
class | o1flt_maxtrack_t |
First order maximum tracker. More... | |
class | o1flt_mintrack_t |
First order minimum tracker. More... | |
class | iir_filter_state_t |
class | iir_filter_t |
IIR filter class wrapper for integration into parser structure. More... | |
class | adapt_filter_state_t |
class | adapt_filter_param_t |
class | adapt_filter_t |
Adaptive filter. More... | |
class | fftfilter_t |
FFT based FIR filter implementation. More... | |
class | fftfilterbank_t |
FFT based FIR filterbank implementation. More... | |
struct | transfer_function_t |
a structure containing a source channel number, a target channel number, and an impulse response. More... | |
struct | transfer_matrix_t |
A sparse matrix of transfer function partitionss. More... | |
class | partitioned_convolution_t |
A filter class for partitioned convolution. More... | |
class | smoothspec_t |
Smooth spectral gains, create a windowed impulse response. More... | |
class | resampling_filter_t |
Hann shaped low pass filter for resampling. More... | |
class | polyphase_resampling_t |
A class that performs polyphase resampling. More... | |
class | blockprocessing_polyphase_resampling_t |
A class that does polyphase resampling and takes into account block processing. More... | |
class | iir_ord1_real_t |
First order recursive filter. More... | |
Functions | |
template<typename T , typename std::enable_if< std::is_floating_point< T >::value, T >::type * = nullptr> | |
void | make_friendly_number (T &x) |
void | o1_lp_coeffs (const mha_real_t tau, const mha_real_t fs, mha_real_t &c1, mha_real_t &c2) |
Set first order filter coefficients from time constant and sampling rate. More... | |
void | butter_stop_ord1 (double *A, double *B, double f1, double f2, double fs) |
Setup a first order butterworth band stop filter. More... | |
std::vector< float > | fir_lp (float f_pass_, float f_stop_, float fs_, unsigned order_) |
Setup a nth order fir low pass filter. More... | |
MHASignal::waveform_t * | spec2fir (const mha_spec_t *spec, const unsigned int fftlen, const MHAWindow::base_t &window, const bool minphase) |
Create a windowed impulse response/FIR filter coefficients from a spectrum. More... | |
unsigned | gcd (unsigned a, unsigned b) |
greatest common divisor More... | |
double | sinc (double x) |
sin(x)/x function, coping with x=0. More... | |
std::pair< unsigned, unsigned > | resampling_factors (float source_sampling_rate, float target_sampling_rate, float factor=1.0f) |
Computes rational resampling factor from two sampling rates. More... | |
Namespace for IIR and FIR filter classes.
|
inline |
void MHAFilter::o1_lp_coeffs | ( | const mha_real_t | tau, |
const mha_real_t | fs, | ||
mha_real_t & | c1, | ||
mha_real_t & | c2 | ||
) |
Set first order filter coefficients from time constant and sampling rate.
tau | Time constant |
fs | Sampling rate |
c1 | Recursive filter coefficient |
c2 | Non-recursive filter coefficient |
void MHAFilter::butter_stop_ord1 | ( | double * | A, |
double * | B, | ||
double | f1, | ||
double | f2, | ||
double | fs | ||
) |
Setup a first order butterworth band stop filter.
This function calculates the filter coefficients of a first order butterworth band stop filter.
A | recursive filter coefficients |
B | non recursive filter coefficients |
f1 | lower frequency |
f2 | upper frequency |
fs | sample frequency |
std::vector< float > MHAFilter::fir_lp | ( | float | f_pass_, |
float | f_stop_, | ||
float | fs_, | ||
unsigned | order_ | ||
) |
Setup a nth order fir low pass filter.
This function calculates the filter coefficients of a nth order fir low pass filter filter. Frequency arguments above the nyquist frequency are accepted but the spectral response is truncated at the nyquist frequency
f_pass_ | Upper passband frequency |
f_stop- | Lower stopband frequency |
fs_ | sample frequency |
MHASignal::waveform_t * MHAFilter::spec2fir | ( | const mha_spec_t * | spec, |
const unsigned int | fftlen, | ||
const MHAWindow::base_t & | window, | ||
const bool | minphase | ||
) |
Create a windowed impulse response/FIR filter coefficients from a spectrum.
spec | Input spectrum |
fftlen | FFT length of spectrum |
window | Window shape (with length, e.g. initialized with MHAWindow::hanning(54)). |
minphase | Flag, true if original phase should be discarded and replaced by a minimal phase function. |
|
inline |
greatest common divisor
double MHAFilter::sinc | ( | double | x | ) |
sin(x)/x function, coping with x=0.
This is the historical sinc function, not the normalized sinc function.
std::pair< unsigned, unsigned > MHAFilter::resampling_factors | ( | float | source_sampling_rate, |
float | target_sampling_rate, | ||
float | factor = 1.0f |
||
) |
Computes rational resampling factor from two sampling rates.
The function will fail if either sampling_rate * factor is not an integer
source_sampling_rate | The original sampling rate |
target_sampling_rate | The desired sampling rate |
factor | A helper factor to use for non-integer sampling rates |
MHA_Error | if no rational resampling factor can be found. |