The Open Master Hearing Aid (openMHA)  openMHA
Open community platform for hearing aid algorithm research
dc.cpp File Reference

Macros

#define DUPVEC(x)   v.x.data = MHASignal::dupvec_chk(v.x.data,s)
 

Functions

static unsigned int get_audiochannels (unsigned int totalchannels, std::string acname, MHA_AC::algo_comm_t &ac)
 The dynamic compressor implemented by plugin dc was created to perform multi-band dynamic compression as found in hearing aids. More...
 

Macro Definition Documentation

◆ DUPVEC

#define DUPVEC (   x)    v.x.data = MHASignal::dupvec_chk(v.x.data,s)

Function Documentation

◆ get_audiochannels()

static unsigned int get_audiochannels ( unsigned int  totalchannels,
std::string  acname,
MHA_AC::algo_comm_t ac 
)
static

The dynamic compressor implemented by plugin dc was created to perform multi-band dynamic compression as found in hearing aids.

In hearing aid simulation tasks, openMHA will normally simulate either one or two hearing aids (i.e., aid one or two ears).

The filter bank which splits the broadband input signal from left and/or right microphone is not part of plugin dc. openMHA researchers can use a filterbank plugin of their choice, e.g. fftfilterbank. Filter banks split broadband signal channels into multiple narrow-band signal channels: A filter bank with 10 frequency bands would split one broadband signal channel into 10 narrow-band signal channels, and the dc plugin will then only see these 10 narrow-band audio signal channels. The same filter bank would split 2 broadband channels into 20 narrow-band channels, i.e. 10 channels per ear.

For hearing aid fitting, the fitting rule should be able to detect if the dc plugin fits one hearing aid or two hearing aids. The dc plugin can normally not derive this information from the incoming audio signal dimensions alone, but the filterbank that was used to split the broadband signals into narrow-band signal knows the original number of broadband channels. MHA filterbank plugins therefore publish an AC variable containing the original number of broadband audio channels, which were present before the filterbank split the signal into frequency bands.

This function accesses the AC space and reads the number of broadband audio channels from the AC variable acname, which must be given by the configuration and should identify the AC variable published by the filter bank for this purpose.

If acname is empty, then the function parameter totalchannels is returned instead, assuming that there was no filterbank and all input channels that the dc plugin receives are broadband audio channels.

Parameters
totalchannelsThe number of audio channels that dc receives from the MHA (MHA informs plugins about the number of input signal channels with the prepare() callback). If the dc plugin processes the output signal of a filter bank, then this will be the equal to the number of broadband input channels multiplied by the number of filter bank bands. If not, this will already be the number of broadband input channels.
acnameIf non-empty, name of an AC variable that contains the number of broadband input processed by an up-stream filter bank plugin. An empty acname denotes that no filter bank is present and that the dc plugin directly processes broadband audio signals.
acAlgorithm communication variable space, needed to access AC variable acname.
Returns
The number of broadband audio channels from which the input signal of dc was generated. This will usually be 1 or 2 for normal hearing aid simulation task, but the dc plugin is not restricted to process only 1 or 2 broadband signals, therefore other return values are possible, but then hearing aid fitting rules querying the dc plugin may become confused.
Warning
Since this function accesses the AC variable space, it may only be called in situation where a plugin is allowed to interact with the AC variable space. This function should be called from prepare()