SampleStatistics
Overview
Computes sample statistics over multichannel signals
Discussion
This module calculates the sample statistics of the input signal on a sample-by-sample basis. The input pin can have an arbitray number of interleaved channels and the sample statistics calculation occurs over all channels. The output pin has only a single channel and a blockSize equal to that of input.
For each channel, the module calculates the type of statistics depending on the variable statisticsType selection. The available options are: 0=maximum, 1=minimum, 2=maximum absolute value, and 3=minimum absolute value, 4=mean, 5=RMS, 6=standard deviation, 7=variance, 8=average energy, 9=sum, 10=sum of squares. This includes all channels and the entire block.
If the argument OUTPUTINDEX is checked, then a 2nd output pin will be created. The 2nd output is the corresponding index value of the output operation. The index starts at 0. So an output value of 0 corresponds to the 1st channel. The optional 2nd output pin is single channel, int, with the same block size as the input.
The module also exposes the computed signal as a state variable.
Type Definition
typedef struct _ModuleSampleStatistics
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
INT32 statisticsType; // Type of statistics calculated: 0=maximum, 1=minimum, 2=maximum absolute value, 3=minimum absolute value.
} ModuleSampleStatisticsClass;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
statisticsType | int | parameter | 0 | 0 | 0:10 |
Pins
Input Pins
Name: in
Description: Audio input
Data type: float
Channel range: Unrestricted
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: out
Description: Sample statistics output
Data type: float
Name: index
Description: Index value
Data type: int
MATLAB Usage
File Name: sample_statistics_module.m
M=sample_statistics_module(NAME, OUTPUTINDEX)
This module calculates the statistics on sample-by-sample basis of an
arbitrary number of interleaved channels. The type of statistics calculated
is determined by the statisticsType parameter.
Arguments:
NAME - name of the module.
OUTPUTINDEX - boolean value which specifies whether the module will
have an optional 2nd output which outputs the channel index value of
the sample value is outputed. By default, OUTPUTINDEX = 0, which means
no 2nd output channel will be created. The 2nd output will be of the
data type int. The index starts at 0. So an output value of 0 means
channel 1 of the input.