The Open Master Hearing Aid (openMHA)
openMHA
Open community platform for hearing aid algorithm research
|
Smooth spectral gains, create a windowed impulse response. More...
Public Member Functions | |
smoothspec_t (unsigned int fftlen, unsigned int nchannels, const MHAWindow::base_t &window, bool minphase, bool linphase_asym=false) | |
Constructor. More... | |
void | smoothspec (const mha_spec_t &s_in, mha_spec_t &s_out) |
Create a smoothed spectrum. More... | |
void | smoothspec (mha_spec_t &spec) |
Create a smoothed spectrum (in place) More... | |
void | spec2fir (const mha_spec_t &spec, mha_wave_t &fir) |
Return FIR coefficients. More... | |
~smoothspec_t () | |
Private Member Functions | |
void | internal_fir (const mha_spec_t &) |
Private Attributes | |
unsigned int | fftlen |
unsigned int | nchannels |
MHAWindow::base_t | window |
MHASignal::waveform_t | tmp_wave |
MHASignal::spectrum_t | tmp_spec |
MHASignal::minphase_t * | minphase |
bool | _linphase_asym |
mha_fft_t | fft |
Smooth spectral gains, create a windowed impulse response.
Spectral gains are smoothed by multiplying the impulse response with a window function.
If a minimal phase is used, then the original phase is discarded and replaced by the minimal phase function. In this case, the window is applied to the beginning of the inverse Fourier transform of the input spectrum, and the remaining signal set to zero. If the original phase is kept, the window is applied symmetrically arround zero, i.e. to the first and last samples of the inverse Fourier transform of the input spectrum. The spec2fir() function creates a causal impulse response by circularly shifting the impulse response by half of the window length.
The signal dimensions of the arguments of smoothspec() must correspond to the FFT length and number of channels provided in the constructor. The function spec2fir() can fill signal structures with more than window length frames.
MHAFilter::smoothspec_t::smoothspec_t | ( | unsigned int | fftlen, |
unsigned int | nchannels, | ||
const MHAWindow::base_t & | window, | ||
bool | minphase, | ||
bool | linphase_asym = false |
||
) |
Constructor.
fftlen | FFT length of input spectrum (fftlen/2+1 bins) |
nchannels | Number of channels in input spectrum |
window | Window used for smoothing |
minphase | Use minimal phase (true) or original phase (false) |
linphase_asym | Keep phase, but apply full window at beginning of IRS |
MHAFilter::smoothspec_t::~smoothspec_t | ( | ) |
void MHAFilter::smoothspec_t::smoothspec | ( | const mha_spec_t & | s_in, |
mha_spec_t & | s_out | ||
) |
Create a smoothed spectrum.
s_in | Input spectrum |
s_out | Output spectrum |
|
inline |
Create a smoothed spectrum (in place)
spec | Spectrum to be smoothed. |
void MHAFilter::smoothspec_t::spec2fir | ( | const mha_spec_t & | spec, |
mha_wave_t & | fir | ||
) |
Return FIR coefficients.
spec | Input spectrum |
fir | FIR coefficients, minimum length is window length |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |