Document toolboxDocument toolbox

(8.D.2.1) LMSNormFract32

Overview

LMS Norm fract32 filter

Discussion

The LMS fract32 module implements a single channel, N-order FIR adaptive filter using a Normalized Least Means Squares algorithm. The module takes 2 single channel inputs: desired filter output and filter input (the reference signal). For every data sample the filter output is compared to the desired output 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 - actual filter output. The adaptation constant mu is visible as a user variable.

Type Definition

typedef struct _ModuleLMSNormFract32 { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure INT32 numTaps; // Length of the filter FLOAT32 mu; // mu Step size INT32 stateIndex; // Index of the oldest state variable in the array of state variables INT32 prev_stateptr; // Index of the oldest state variable in the array of state variables INT32 postShift; // Coefficient Scaling fract32 mufract32; // mu Step size fract32 E; // saves previous frame energy fract32 x0; // saves previous input sample fract32* coeffsfract32; // Coefficient array fract32* state; // State variable array } ModuleLMSNormFract32Class;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

numTaps

int

const

0

31

1:1:5000

samples

mu

float

parameter

0

0.02

0:0.999

linear

stateIndex

int

state

1

0

Unrestricted

 

prev_stateptr

int

state

1

0

Unrestricted

 

postShift

int

derived

1

0

Unrestricted

 

mufract32

fract32

derived

1

0.02

Unrestricted

 

E

fract32

state

1

0

Unrestricted

 

x0

fract32

state

1

0

Unrestricted

 

coeffsfract32

fract32*

derived

0

[31 x 1]

Unrestricted

 

state

fract32*

state

1

[62 x 1]

Unrestricted

 

Pins

Input Pins

Name: in1

Description: audio input

Data type: fract32

Channel range: 1

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real

 

Name: in2

Description: desired input

Data type: fract32

Channel range: 1

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: out1

Description: audio output

Data type: fract32

 

Name: out2

Description: error output

Data type: fract32

MATLAB Usage

File Name: lms_norm_fract32_module.m

M=lms_norm_fract32_module(NAME, MAXTAPS) Creates a normalized LMS FIR filter for use in the Audio Weaver environment. 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

Â