SbNLMSV3
Overview
Subband normalized LMS adaptive filter
Discussion
The SbNLMSV3 module implements a subband-based normalized LMS algorithm. This module is identical to v2 except for a clarification of the names of the input and output signals. NLMS, when used as an Acoustic Echo Canceller, should use the "desired" signal for the mic input, and the "input" signal for the AEC reference. The pin locations have been swapped to match those of other sb aec modules. There is a separate complex filter within each subband. The module takes 2 single channel inputs: A desired signal and an input to be filtered so that can match the desired signal. For an AEC application, the reference signal goes to input, and the mic signal goes to desired. For every data sample the filtered output is compared to the desired signal and this information is used to update the filter taps according to the normalized LMS algorithm. The module always has 2 single channel ouputs: adaptive filter output and error signal, (desired-(filter output)). The error signal is the output for an AEC system, while the filtered output is ignored. The array .coeffs holds complex filter coefficients and is of size numTaps x numBins, where numBins is the number of frequency domain bins (or subbands). numBins equals the FFT size / 2 + 1. The coefficients are stored in coeffs in normal order. The state variable array is complex data of size numTaps x numBins, and circular buffer is used within each subband.
The constructor argument MAXTAPS specifies the maximum number of taps in the filter. The variable .numTaps specifies how many taps are actually used. numTaps is in the range 1 to MAXTAPS.
The constructor argument MUINPUT determines where the adaptation parameter mu is taken from. By default, MUINPUT = 0 and the adaptation parameter is taken from the internal parameter .mu; the same factor is used for all subbands. If MUINPUT = 1, then the module has a 3rd input pin. This pin contains real data of size FFT size / 2 + 1 and each point specifies the mu factor for each subband. This allows external logic to be used when computing mu and allows mu to vary between subbands. When MUINPUT = 1 then the internal paramter .mu is ignored.
Type Definition
typedef struct _ModuleSbNLMSV3
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
INT32 maxTaps; // Maximum length of the filter
INT32 numTaps; // Current length of the filter
FLOAT32 mu; // Adaptation constant
FLOAT32 offset; // Normalization offset constant
INT32 stateIndex; // Index of the oldest state variable in the array of state variables
FLOAT32* coeffs; // Coefficient array
FLOAT32* state; // State variable array
FLOAT32* W; // Weighted error from last iteration
} ModuleSbNLMSV3Class;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
maxTaps | int | const | 0 | 32 | 1:1:5000 | samples |
numTaps | int | parameter | 0 | 32 | 1:1:32 | samples |
mu | float | parameter | 0 | 0.5 | 0:1 | linear |
offset | float | parameter | 0 | 0.001 | 0:0.001 | linear |
stateIndex | int | state | 1 | 0 | Unrestricted | Â |
coeffs | float* | state | 0 | [32 x 32] | Unrestricted | Â |
state | float* | state | 1 | [32 x 32] | Unrestricted | Â |
W | float* | state | 1 | [32 x 1] | Unrestricted | Â |
Pins
Input Pins
Name: desired
Description: Desired signal at filtered output
Data type: float
Channel range: 1
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Complex
Â
Name: input
Description: signal to be filtered to match desired input (reference for AEC)
Data type: float
Channel range: 1
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Complex
Output Pins
Name: output
Description: Output of adaptive filtered input
Data type: float
Â
Name: errorSignal
Description: Error signal = difference between filtered output and desired signal (AEC output)
Data type: float
MATLAB Usage
File Name: sb_nlms_v3_module.m
M=sb_nlms_v3_module(NAME, MAXTAPS, MUINPUT)
Complex normalized LMS filter which operates in the subband domain.
This module works in conjunction with the STFT analysis and synthesis
module in Audio Weaver. The module has 2 single channel input pins
and 2 single channel output pins:
Input Pin 1: Desired - Adaptive filter desired output
Input Pin 2: input - Adaptive filter input
Output Pin 1: dataOut - output of the input filtered by the adaptive filter
Output Pin 2: errorSignal - difference between dataIn and dataOut
Arguments:
NAME - name of the module.
MAXTAPS - maximum length of the filter (number of complex taps).
MUINPUT - optional Boolean input which specifies whether the per
bin mu parameter is input on a pin. By default,
MUINPUT = 0 and the mu factor for all filters is set
by the parameter .mu. When MUINPUT = 1, then the
third input pin on the mu specifies the per bin mu
parameter and the instance variable .mu is ignored.
Â