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
Code Block |
---|
typedef struct _ModuleDb20Fract32 { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure } ModuleDb20Fract32Class; |
Pins
Input Pins
Name: in
Description: Input signal
...
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
...