Skip to main content
Skip table of contents

AveragerFract32

Overview

Advanced multichannel averager fract32 version

Discussion

Intelligent averager module which avoids the startup transient. When the module starts it uses a cumulative averaging method and then later on switches to exponential averaging. The .smoothingTime variable determines the averaging interval. Cumulative averaging lasts for .smoothingTime msec and when this is done the module switches to exponential averaging.

The module supports multichannel inputs and separately computes the average for each channel. That is, if the input has N channels then the output will also have N channels. The average is computed on a sample by sample basis.

The module has an optional reset pin which is enabled using the RESETPIN argument. The module checks the first sample of data on the reset pin and if non-zero restarts averaging. The module starts in cumulative averaging mode and then switches to exponential averaging.

Type Definition

CODE
typedef struct _ModuleAveragerFract32
{
    ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
    FLOAT32 smoothingTime;                        // Time constant of the smoothing process.
    fract32 smoothingCoeff;                       // Smoothing coefficient.
    INT32 sampleCounter;                          // Number of samples processed since last reset.
    INT32 switchCount;                            // When to switch from cumulative to exponential averaging.
    INT32 stateSize;                              // Size of the state array derived from input pin.
    fract32* state;                               // Instantaneous average value.
} ModuleAveragerFract32Class;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

smoothingTime

float

parameter

0

100

0:1:10000

msec

smoothingCoeff

fract32

derived

1

0.0002083

Unrestricted

sampleCounter

int

state

1

0

Unrestricted

switchCount

int

derived

1

4800

Unrestricted

stateSize

int

state

1

1

Unrestricted

state

fract32*

state

0

[1 x 1]

Unrestricted

Pins

Input Pins

Name: reset

Description: Resets averaging

Data type: int

Channel range: 1

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real

Name: in

Description: Input signal

Data type: fract32

Channel range: Unrestricted

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: out

Description: Output signal

Data type: fract32

MATLAB Usage

File Name: averager_fract32_module.m

CODE
 M = averager_fract32_module(NAME, RESETPIN)
 Advanced averager module which eliminates the startup transient.  The
 module separately averages each input channel. Arguments:
    NAME - name of the module.
    RESETPIN - optional Boolean variable that specifies if the module
       has a reset pin.  By default RESETPIN = 0.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.