(8.D.1.2) RunningMinMax
Overview
Computes long term min/max/max abs
Discussion
This module keeps track of the maximum (minimum, and maximum absolute value) seen on the input. This is useful, for example, for keeping track of peak signal levels. The state variable value holds the maximum value seen thus far.
The statisticsType variable configures which type of computation the block does: 0=Maximum, 1=Minimum, 2=Maximum Absolute Value.
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 _ModuleRunningMinMax
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
INT32 statisticsType; // Type of statistics needed.
FLOAT32 value; // Instantaneous output value.
INT32 reset; // Trigger pin to reset monitoring.
} ModuleRunningMinMaxClass;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
statisticsType | int | parameter | 0 | 0 | 0:2 | Â |
value | float | state | 0 | 0 | -60:10 | Â |
reset | int | state | 0 | 1 | Unrestricted | Â |
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: State value output
Data type: float
MATLAB Usage
File Name: running_minmax_module.m
M=running_minmax_module(NAME, OUTPUTVALUE)
This module keeps track of the largest (or smallest) value in 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.
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.
Â