Skip to main content
Skip table of contents

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

CODE
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

CODE
 M=scale_offset_fract32_module(NAME)
 Creates a scale and offset object for use with the Audio Weaver.  
 Arguments:
    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.