Overview
Subband normalized LMS adaptive filter
Discussion
The SbNLMS module implements a subband-based normalized LMS algorithm. There is a separate complex filter within each subband. The module takes 2 single channel inputs: filter input data and reference signal (desired filter output). For every data sample the filter output is compared to the reference 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, (reference-(filter output)). 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 _ModuleSbNLMS { 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 } ModuleSbNLMSClass;
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 |
Pins
Input Pins
Name: dataIn
Description: Filter input
Data type: float
Channel range: 1
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Complex
Name: reference
Description: Reference input: desired filter output
Data type: float
Channel range: 1
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Complex
Name: mu
Description: Per bin mu parameter
Data type: float
Channel range: 1
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: dataOut
Description: Filter output
Data type: float
Name: errorSignal
Description: Error signal = difference between filter output and reference input
Data type: float
MATLAB Usage
File Name: sb_nlms_module.m
M=sb_nlms_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: dataIn - Adaptive filter desired output Input Pin 2: reference - Adaptive filter input Output Pin 1: dataOut - output of 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.