(8.D.2.5) RMSFract32
Overview
RMS detector with built-in smoothing
Discussion
This module calculates the Fractional smoothed RMS value of the input signal on a block-by-block basis. The input pin can have an arbitray number of interleaved channels and the RMS calculation occurs over all channels. The output pin has a single channel and a blockSize of 1.
The following algorithm is used internally. For each block, the sum of the square of all input data is computed (the energy). This includes all channels and the entire block. 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.
The module also exposes some of the computed signals as state variables. filteredValue holds the output of the module (the smoothed RMS value). instantaneousValue holds the square root of the average energy in the block; no smoothing.
Type Definition
typedef struct _ModuleRMSFract32
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
FLOAT32 smoothingTime; // Time interval over which to smooth the measurement
fract32 instantaneousValue; // Instantaneous (unsmoothed) output value
fract32 filteredValue; // Smoothed output value
fract32 a1; // a1 coefficient of 1st order smoothing filter
fract32 b0; // b0 coefficient of 1st order smoothing filter
fract32 b1; // b1 coefficient of 1st order smoothing filter
fract32 xNm1; // Delayed input sample
fract32 yNm1; // Delayed output sample
} ModuleRMSFract32Class;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
smoothingTime | float | parameter | 0 | 1000 | 0:10000 | msec |
instantaneousValue | fract32 | state | 0 | 0 | -60:10 | Â |
filteredValue | fract32 | state | 0 | 0 | -60:10 | Â |
a1 | fract32 | derived | 1 | -0.9958 | Unrestricted | Â |
b0 | fract32 | derived | 1 | 0.00418 | Unrestricted | Â |
b1 | fract32 | derived | 1 | 0 | Unrestricted | Â |
xNm1 | fract32 | state | 1 | 0 | Unrestricted | Â |
yNm1 | fract32 | state | 1 | 0 | Unrestricted | Â |
Pins
Input Pins
Name: in1
Description: Audio input
Data type: fract32
Channel range: Unrestricted
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: out
Description: Filtered RMS output
Data type: fract32
MATLAB Usage
File Name: rms_fract32_module.m
M=rms_fract32_module(NAME, NUMIN, OUTPUTVALUE)
RMS detector with built-in smoothing. The module accepts multiple input
signals and computes a control signal which reprsents the Smoothed
RMS value. Arguments:
NAME - name of the module.
NUMIN - number of input pins
Â