Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Scroll Documents: Update page title prefix

Overview

RMS detector with built-in smoothing

Discussion

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 over all channels. The output pin has a single channel and a blockSize of 1.

...

The module also exposes some of the computed signals as state variables. The variable filteredValue holds the output of the module (the smoothed RMS value). The variable instantaneousValue holds the square root of the average energy in the block; no smoothing.

Type Definition

Code Block
typedef struct _ModuleRMS
{
    ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
    FLOAT32 smoothingTime;                        // Time interval over which to smooth the measurement.
    FLOAT32 instantaneousValue;                   // Instantaneous (unsmoothed) output value.
    FLOAT32 filteredValue;                        // Smoothed output value.
    FLOAT32 a1;                                   // a1 coefficient of 1st order smoothing filter.
    FLOAT32 b0;                                   // b0 coefficient of 1st order smoothing filter.
    FLOAT32 b1;                                   // b1 coefficient of 1st order smoothing filter.
    FLOAT32 xNm1;                                 // Delayed input sample.
    FLOAT32 yNm1;                                 // Delayed output sample.
} ModuleRMSClass;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

smoothingTime

float

parameter

0

1000

0:10000

msec

instantaneousValue

float

state

0

0

-60:10

filteredValue

float

state

0

0

-60:10

a1

float

derived

1

-0.9958

Unrestricted

b0

float

derived

1

0.00418

Unrestricted

b1

float

derived

1

0

Unrestricted

xNm1

float

state

1

0

Unrestricted

yNm1

float

state

1

0

Unrestricted

Pins

Input Pins

Name: in1

Description: Audio input

...

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: out

Description: Filtered RMS output

Data type: float

MATLAB Usage

File Name: rms_module.m

Code Block
 M=rms_module(NAME, NUMIN)
 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.