Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Scroll Documents: Update page title prefix

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 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 Block
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

...

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

...