Computes sample statistics over multichannel signals
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.
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.
Description: Audio input
Data type: float
Channel range: Unrestricted
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Real
Description: Sample statistics output
Data type: float
Description: Index value
Data type: int
File Name: sample_statistics_module.m
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.
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.