AdaptLevel: Adapt 'RMS' Power Level

View source: R/AdaptLevel.R

AdaptLevelR Documentation

Adapt RMS Power Level

Description

This function adapts the root mean square (RMS) power level of the signal to the specified dB level (indB). For a sampled signal s_i\ (i=1,…,n), the RMS is defined as

\code{RMS}\{s_i\}=√{\frac{1}{n}∑_{i=1}^n s_i^{2}.}

The factor to adapt the signal is calculated as \code{factor}=10\times\log_{10}(\code{indB}/\code{RMS}).

Usage

AdaptLevel(inSignal, indB)

Arguments

inSignal

a numeric vector representing the input signal.

indB

a scalar indicating the wanted level (0 is maximum level without clipping, -20 is reasonable).

Details

The reference value of 0 dB is the level of a square wave with amplitude 1. Thus, a sine wave with amplitude 1 yields -3.01 dB.

Value

A numeric vector representing the adapted input signal.

Note

The multi-channel version of AdaptLevel is deprecated and only is available in IPEM Toolbox.

Author(s)

Marc Vidal (R version). Based on the original code from IPEM Toolbox.

Examples

ALs <- AdaptLevel(SchumannKurioseGeschichte, -20)

m-vidal/eaR documentation built on Nov. 18, 2022, 3:55 p.m.