Document toolboxDocument toolbox

(8.D.2.1) RunningStatisticsFract32

Overview

Computes long term statistics. Fract32 version.

Discussion

This module keeps track of the statistics of the input data. The state variable value holds the statistic result seen thus far.

The statisticsType variable configures which type of computation the block does: 0=Maximum, 1=Minimum, 2=Maximum Absolute Value, Mean=3, RMS=4, StdDev=5, Var=6, AvgEnergy=7.

An optional constructor argument OUTPUTVALUE specifies whether the computed statistic should be output on an output pin. By default, OUTPUTVALUE=0 and the statistic is only stored internally in instantaneousValue. The .reset variable is used to clear history and restart the calculation. The variable .reset is set to 1 when the module is first constructed.

Type Definition

typedef struct _ModuleRunningStatisticsFract32 { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure INT32 statisticsType; // Type of statistics needed. fract32 value; // Instantaneous output value. fract32 mean; // Instantaneous mean value. fract32 avgEnergy; // State variable for average energy. INT32 numBlocksProcessed; // Counter for the number of blocks processed. INT32 reset; // Used to identify the first block which is processed. } ModuleRunningStatisticsFract32Class;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

statisticsType

int

parameter

0

0

0:7

 

value

fract32

state

0

0

-60:10

 

mean

fract32

state

0

0

Unrestricted

 

avgEnergy

fract32

state

0

0

Unrestricted

 

numBlocksProcessed

int

state

0

0

Unrestricted

 

reset

int

state

0

1

Unrestricted

 

Pins

Input Pins

Name: in

Description: Audio input

Data type: fract32

Channel range: Unrestricted

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: out

Description: State value output

Data type: fract32

MATLAB Usage

File Name: running_statistics_fract32_module.m

M=running_statistics_fract32_module(NAME, OUTPUTVALUE) This module keeps track of some of the statistics of the input and stores this to the internal state variable value. The module uses all samples since the start of processing. A number of different statistics can be calculated based on the statisticsType parameter. Fract32 version. Fract32 version does not support running sum due to overflow issues. Arguments: NAME - name of the module. OUTPUTVALUE - Boolean value which specifies whether the module has an output pin. If OUTPUTVALUE=0 (the default), then the module has no output pin. If OUTPUTVALUE=1, then the value variable is output as a single sample on the output pin.

Â