The Open Master Hearing Aid (openMHA)  openMHA
Open community platform for hearing aid algorithm research
adaptive_feedback_canceller_config Class Reference

This is the runtime configuration, the main processing will be done in this class. More...

Public Member Functions

 adaptive_feedback_canceller_config (algo_comm_t &ac, const mhaconfig_t in_cfg, adaptive_feedback_canceller *afc)
 
 ~adaptive_feedback_canceller_config ()
 
mha_wave_tprocess (mha_wave_t *MICsig)
 The process() method contains the actual AFC algorithm, the output is stored in LSsig_output. More...
 
void insert ()
 Insert all AC-variables into the AC-space. More...
 

Private Attributes

const unsigned int ntaps
 Length of the estimated filter. More...
 
const unsigned int frames
 Length of a block in samples (fragsize) More...
 
const unsigned int channels
 Number of channels. More...
 
const int n_no_update_
 Number of blocks after startup where the feedback filter is not updated. More...
 
int no_update_count
 Index counting no-update-blocks up to n_no_update_ to check in process() whether a filter update shall be performed or not. More...
 
const mha_real_t fragsize
 Fragsize for computing delay_roundtrip and delay_update, defaults to the MHA's fragsize. More...
 
const mha_real_t stepsize
 Normalized stepsize of the NLMS-Algorithm. More...
 
const mha_real_t min_const
 Minimum constant to prevent division by zero in the NLMS-Algorithm. More...
 
MHASignal::waveform_t forward_sig
 Copy of error signal that is channeled into the forward path processing. More...
 
MHASignal::waveform_t LSsig_initializer
 Signal consisting of zeros, it is only used to initialize the loudspeaker signal (LSsig) for the first iteration (before forward_path_proc.process() is called for the first time). More...
 
mha_wave_tLSsig
 Pointer to the loudspeaker (LS) signal. More...
 
MHASignal::waveform_t LSsig_output
 
MHASignal::delay_t delay_forward_path
 Delay line for additional decorrelation in the forward path. More...
 
MHAParser::mhapluginloader_tforward_path_proc
 Pluginloader to load the plugins that represent the hearing aid processing in the forward path. More...
 
MHASignal::delay_t delay_roundtrip
 Delay line equal to the measured roundtrip latency - fragsize. More...
 
MHASignal::delay_t delay_update
 
std::vector< MHAFilter::filter_tFBfilter_estim
 
MHA_AC::waveform_t FBfilter_estim_ac
 
MHASignal::waveform_t FBsig_estim
 
MHASignal::waveform_t ERRsig
 
MHA_AC::waveform_t ERRsig_ac
 
bool use_lpc_decorr
 
std::vector< MHAFilter::filter_tlpc_filter
 
MHASignal::waveform_t white_LSsig
 Loudspeaker signal, whitened by filtering with LPC coefficients. More...
 
MHASignal::waveform_t white_LSsig_smpl
 Single sample (for each channel) of white_LSsig that will be written to rb_white_LSsig next. More...
 
MHASignal::ringbuffer_t rb_white_LSsig
 Ringbuffer containing the values used to determine the power of white_LSsig in each channel (see channels) and update FBfilter_estim. More...
 
std::vector< mha_real_tcurrent_power
 
MHASignal::waveform_t white_MICsig
 
MHASignal::waveform_t white_FBsig_estim
 
MHASignal::waveform_t white_ERRsig
 
bool debug_mode
 When executing the code for debug purposes this flag can be set to true in order to capture variable states and provide them as AC variables to the user. More...
 
MHA_AC::waveform_t current_power_ac
 
MHA_AC::waveform_t estim_err_ac
 AC-variable publishing the state of 'estim_err' if debug_mode == true 'estim_err' is a variable local to this plugin's process() method. More...
 

Detailed Description

This is the runtime configuration, the main processing will be done in this class.

During runtime AC variables are published by this class, mainly for debbugging purposes.

Constructor & Destructor Documentation

◆ adaptive_feedback_canceller_config()

adaptive_feedback_canceller_config::adaptive_feedback_canceller_config ( algo_comm_t ac,
const mhaconfig_t  in_cfg,
adaptive_feedback_canceller afc 
)
Parameters
acAlgorithm communication variable space
in_cfgMHA signal dimensions for this plugin
adaptive_feedback_cancellerPointer to plugin interface instance, used to extract user configuration values.

◆ ~adaptive_feedback_canceller_config()

adaptive_feedback_canceller_config::~adaptive_feedback_canceller_config ( )

Member Function Documentation

◆ process()

mha_wave_t * adaptive_feedback_canceller_config::process ( mha_wave_t MICsig)

The process() method contains the actual AFC algorithm, the output is stored in LSsig_output.

Parameters
MICsigThe microphone signal which contains the target signal + the feedback signal. The input signal is not altered in place.
Returns
A pointer to LSsig_output which contains the loudspeaker signal that is actually channeled to the output.

◆ insert()

void adaptive_feedback_canceller_config::insert ( )

Insert all AC-variables into the AC-space.

Member Data Documentation

◆ ntaps

const unsigned int adaptive_feedback_canceller_config::ntaps
private

Length of the estimated filter.

◆ frames

const unsigned int adaptive_feedback_canceller_config::frames
private

Length of a block in samples (fragsize)

◆ channels

const unsigned int adaptive_feedback_canceller_config::channels
private

Number of channels.

This plugin assumes that the number of input channels is equal to the number of output channels. Each input is paired with an output and one pair is called a channel. This is necessary because the AFC needs input and output information to work.

◆ n_no_update_

const int adaptive_feedback_canceller_config::n_no_update_
private

Number of blocks after startup where the feedback filter is not updated.

◆ no_update_count

int adaptive_feedback_canceller_config::no_update_count
private

Index counting no-update-blocks up to n_no_update_ to check in process() whether a filter update shall be performed or not.

◆ fragsize

const mha_real_t adaptive_feedback_canceller_config::fragsize
private

Fragsize for computing delay_roundtrip and delay_update, defaults to the MHA's fragsize.

It is assumed that the soundcard's and the MHA's fragsize are equal. In special cases, the user can set this variable to an individual value.

◆ stepsize

const mha_real_t adaptive_feedback_canceller_config::stepsize
private

Normalized stepsize of the NLMS-Algorithm.

◆ min_const

const mha_real_t adaptive_feedback_canceller_config::min_const
private

Minimum constant to prevent division by zero in the NLMS-Algorithm.

◆ forward_sig

MHASignal::waveform_t adaptive_feedback_canceller_config::forward_sig
private

Copy of error signal that is channeled into the forward path processing.

◆ LSsig_initializer

MHASignal::waveform_t adaptive_feedback_canceller_config::LSsig_initializer
private

Signal consisting of zeros, it is only used to initialize the loudspeaker signal (LSsig) for the first iteration (before forward_path_proc.process() is called for the first time).

◆ LSsig

mha_wave_t* adaptive_feedback_canceller_config::LSsig
private

Pointer to the loudspeaker (LS) signal.

The destination of this pointer will be altered by the plugin loaded by the pluginloader in the forward path processing.

◆ LSsig_output

MHASignal::waveform_t adaptive_feedback_canceller_config::LSsig_output
private

◆ delay_forward_path

MHASignal::delay_t adaptive_feedback_canceller_config::delay_forward_path
private

Delay line for additional decorrelation in the forward path.

◆ forward_path_proc

MHAParser::mhapluginloader_t& adaptive_feedback_canceller_config::forward_path_proc
private

Pluginloader to load the plugins that represent the hearing aid processing in the forward path.

◆ delay_roundtrip

MHASignal::delay_t adaptive_feedback_canceller_config::delay_roundtrip
private

Delay line equal to the measured roundtrip latency - fragsize.

The roundtrip latency describes the timespan between playing back and receiving the same signal, including delays induced by soundcard buffering and the transducers. Can be measured via jack_iodelay. It is used on the loudspeaker signal LSsig before the filtering with FBfilter_estim, to achieve about the same temporal alignment to MICsig as the alignment of the target signal and the true feedback signal.

◆ delay_update

MHASignal::delay_t adaptive_feedback_canceller_config::delay_update
private

◆ FBfilter_estim

std::vector<MHAFilter::filter_t> adaptive_feedback_canceller_config::FBfilter_estim
private

◆ FBfilter_estim_ac

MHA_AC::waveform_t adaptive_feedback_canceller_config::FBfilter_estim_ac
private

◆ FBsig_estim

MHASignal::waveform_t adaptive_feedback_canceller_config::FBsig_estim
private

◆ ERRsig

MHASignal::waveform_t adaptive_feedback_canceller_config::ERRsig
private

◆ ERRsig_ac

MHA_AC::waveform_t adaptive_feedback_canceller_config::ERRsig_ac
private

◆ use_lpc_decorr

bool adaptive_feedback_canceller_config::use_lpc_decorr
private

◆ lpc_filter

std::vector<MHAFilter::filter_t> adaptive_feedback_canceller_config::lpc_filter
private

◆ white_LSsig

MHASignal::waveform_t adaptive_feedback_canceller_config::white_LSsig
private

Loudspeaker signal, whitened by filtering with LPC coefficients.

If use_lpc_decorr is false then this is just a copy of LSsig before the delays.

◆ white_LSsig_smpl

MHASignal::waveform_t adaptive_feedback_canceller_config::white_LSsig_smpl
private

Single sample (for each channel) of white_LSsig that will be written to rb_white_LSsig next.

For the filter estimation we have to use a ringbuffer with the size of filter_length to buffer white_LSsig. For each filter tap we have to update the buffer and it is only possible to update a ringbuffer with a whole waveform_t. That is why we have to use this single sample variable.

◆ rb_white_LSsig

MHASignal::ringbuffer_t adaptive_feedback_canceller_config::rb_white_LSsig
private

Ringbuffer containing the values used to determine the power of white_LSsig in each channel (see channels) and update FBfilter_estim.

The ringbuffer has a size equal to filter_length.

◆ current_power

std::vector<mha_real_t> adaptive_feedback_canceller_config::current_power
private

◆ white_MICsig

MHASignal::waveform_t adaptive_feedback_canceller_config::white_MICsig
private

◆ white_FBsig_estim

MHASignal::waveform_t adaptive_feedback_canceller_config::white_FBsig_estim
private

◆ white_ERRsig

MHASignal::waveform_t adaptive_feedback_canceller_config::white_ERRsig
private

◆ debug_mode

bool adaptive_feedback_canceller_config::debug_mode
private

When executing the code for debug purposes this flag can be set to true in order to capture variable states and provide them as AC variables to the user.

The following variables are captured: FBfilter_estim_ac, ERRsig_ac, current_power_ac, estim_err_ac

◆ current_power_ac

MHA_AC::waveform_t adaptive_feedback_canceller_config::current_power_ac
private

◆ estim_err_ac

MHA_AC::waveform_t adaptive_feedback_canceller_config::estim_err_ac
private

AC-variable publishing the state of 'estim_err' if debug_mode == true 'estim_err' is a variable local to this plugin's process() method.

It represents a part of the NLMS equation, namely the stepsize normalized by current_power times ERRsig.


The documentation for this class was generated from the following files: