Skip to main content
Skip table of contents

Db20Approx

Overview

Converts from linear units to decibels using a fast approximation

Discussion

Converts from linear units to decibels (db20) using a polynomial approximation. The function uses a 3rd order polynomial and the maximum error over the entire input range is 0.003 dB.

Type Definition

CODE
typedef struct _ModuleDb20Approx
{
    ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
} ModuleDb20ApproxClass;

Pins

Input Pins

Name: in

Description: Input signal

Data type: float

Channel range: Unrestricted

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: out

Description: Output signal

Data type: float

MATLAB Usage

File Name: db20_approx_module.m

CODE
 M=db20_approx_module(NAME)
 Creates an Audio Weaver module that computes the function 20*log10(abs(x))
 using a polynomial approximation. This converts from linear units to decibels.
 The approximation is accurate to 7.984884e-003 dB.
    NAME - name of the module.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.