(8.D.2.3) ScaleOffsetFract32
Overview
Linear multichannel scale and offset
Discussion
Scales the input Fract32 signal, and adds a fixed Fract32 (DC) offset. The ScaleOffset module is useful for specific nonlinearities, as well as in dynamics processing, where the scale and offset can occur in the log domain.
The output is computed on a sample by sample basis according to the formula: y[n] = ((gainFract32 * x[n]) SHIFT shiftFract32) + offsetFract32
gainFract32 and shiftFract32 are derived based on the gain value. The final output y[n] will also be clipped to be between 1 and -1.
Type Definition
typedef struct _ModuleScaleOffsetFract32
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
FLOAT32 gain; // Linear gain
FLOAT32 offset; // DC offset
fract32 offsetFract32; // DC offset Fract32
fract32 gainFract32; // Linear gain Fract32
INT32 shift; // Number of bits to shift
} ModuleScaleOffsetFract32Class;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
gain | float | parameter | 0 | 1 | -10:10 | Â |
offset | float | parameter | 0 | 0.99 | -10:10 | Â |
offsetFract32 | fract32 | derived | 1 | 0.99 | Unrestricted | Â |
gainFract32 | fract32 | derived | 1 | 0.5 | Unrestricted | Â |
shift | int | derived | 1 | 1 | Unrestricted | Â |
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: scale_offset_fract32_module.m
M=scale_offset_fract32_module(NAME)
Creates a scale and offset object for use with the Audio Weaver.
Arguments:
NAME - name of the module.
Â