(8.D.2.7) Db20Fract32
Overview
Converts from linear units to decibels using a polynomial approximation
Discussion
Converts from linear units to decibels (db20) using a polynomial approximation. The input format is Q9.23 (values in the range +/- 128) and the output format is Q9.23 also (values in the range +/- 128). The function computes the absolute value of the input before computing the log. The output will always be in the range [48.16 -198.4738]. The results are accurate to within 8e-3 (in Q9.23).
For negative inputs the function takes the absolute value. An input of 0 returns -256.
Type Definition
typedef struct _ModuleDb20Fract32
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
} ModuleDb20Fract32Class;
Pins
Input Pins
Name: in
Description: Input signal
Data type: fract32
Channel range: Unrestricted
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: out
Description: Output signal
Data type: fract32
MATLAB Usage
File Name: db20_fract32_module.m
M=db20_fract32_module(NAME)
Creates an Audio Weaver module that computes the function 20*log10(abs(x))
using a polynomial approximation. The input and the output are Q9.23.
Arguments:
NAME - name of the module.
Â