Db10Fract32
Overview
Converts from linear units to decibels (db10)
Discussion
Converts from linear units to decibels (db10) 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 _ModuleDb10Fract32
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
} ModuleDb10Fract32Class;
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: db10_fract32_module.m
M = db10_fract32_module(NAME)
Creates an Audio Weaver module that computes the function 10*log10(abs(x))
using a polynomial approximation. The input and the output are Q9.23.
Arguments:
NAME - name of the module.