Overview
Advanced multichannel averager
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 _ModuleAverager { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure FLOAT32 smoothingTime; // Time constant of the smoothing process. FLOAT32 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. FLOAT32* state; // Instantaneous average value. } ModuleAveragerClass; |
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
smoothingTime | float | parameter | 0 | 100 | 0:1:10000 | msec |
smoothingCoeff | float | derived | 1 | 0.0002083 | Unrestricted | |
sampleCounter | int | state | 1 | 0 | Unrestricted | |
switchCount | int | derived | 1 | 4800 | Unrestricted | |
stateSize | int | state | 1 | 1 | Unrestricted | |
state | float* | 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: float
MATLAB Usage
File Name: averager_module.m
...