Multichannel RMS detector with built-in smoothing
This module calculates the smoothed RMS value of the input signal on a block-by-block basis. The input pin can have an arbitrary number of interleaved channels and the RMS calculation occurs on a channel by channel basis. The output pin has a multiple channels all with a blockSize of 1.
The following algorithm is used internally. For each channel, the sum of the square of all input data is computed (the energy). Next, the energy is divided by the number of samples to yield the average energy. The average energy then passes through a first order lowpass filter with a specified integration time (the smoothingTime). Finally, the square root of the filter output is computed and this serves as the output of the module.
typedef struct _ModuleRMSN
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
FLOAT32 smoothingTime; // Time interval over which to smooth the measurement.
FLOAT32 a1; // a1 coefficient of 1st order smoothing filter.
FLOAT32 b0; // b0 coefficient of 1st order smoothing filter.
FLOAT32* energy; // Array of squared energy values, one per channel.
[1 x 1]
Description: Audio input
Data type: float
Channel range: Unrestricted
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Real
Description: Filtered RMS output
Data type: float
File Name: rmsn_module.m
M = rmsn_module(NAME)
Multichannel RMS detector with a separate value computed per input
channel. The module has a single multichannel input (numChan x blockSize)
and a single multichannel output (1 x blockSize). The module has a
configurable smoothing time. Arguments:
NAME - name of the module.