Skip to main content
Skip table of contents

ScalerSymmetricFading

Overview

General purpose scaler with a single gain and a fading time in which the fadein/fadeout needs to be accomplished

Discussion

Scaler (or gain) module for floating-point signals with symmetric fading time and gain as control parameters. Compared to the general purpose scaler, the fadein and fadeout takes equal time as parameter fadingTime. This module has a parameter name "gain" which specifies the gain to apply. The same gain is applied to all channels.

Gain is intrepreted as either a linear value or as a dB value based on the isDB module variable. By default, isDB=1 and the gain parameter is treated as a dB value. If you set isDB=0 then the gain parameter is treated as a linear value. Make sure that linear gain is not negative.

The module can also switch between smoothed and unsmoothed gain changes. You enable smoothing by setting the parameter fadingTime to a non-zero value. If fadingTime=0 then no smoothing is performed. The module is slightly more efficient when no smoothing occurs. A linera gain of 0 corresponds to -200dB. The module supports multiple input and output pins using the argument NUMPINS. By default, NUMPINS=1 and the module has a single input and output pin. If you set NUMPINS > 1 then you can scale multiple signals. The same gain variable is used across signals. The description above applies to real data. The module can also handle complex data but in the case of complex data no smoothing is performed.

Type Definition

CODE
typedef struct _ModuleScalerSymmetricFading
{
    ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
    FLOAT32 gain;                                 // Gain in either linear or dB units. Make sure that linear gain is not negative.
    FLOAT32 fadingTime;                           // Time in which the taget gain has to be attained (0 = unsmoothed).
    INT32 isDB;                                   // Selects between linear (=0) and dB (=1) operation
    FLOAT32 factor;                               // The exponential factor that is to be multplied with gain for smoothing.
    INT32 numSamples;                             // Number of samples over which smoothing is needed to be applied.
    FLOAT32 targetGain;                           // Target gain in linear units.
    FLOAT32 prevGain;                             // Previous gain in linear units.
    FLOAT32 currentGain;                          // Instantaneous gain applied by the module.
} ModuleScalerSymmetricFadingClass;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

gain

float

parameter

0

0

-24:24

dB

fadingTime

float

parameter

0

10

0:1000

msec

isDB

int

parameter

0

1

0:1

factor

float

derived

1

1

Unrestricted

numSamples

int

derived

1

0

Unrestricted

targetGain

float

derived

1

1

Unrestricted

prevGain

float

derived

1

1

Unrestricted

currentGain

float

derived

1

1

Unrestricted

Pins

Input Pins

Name: in1

Description: audio input

Data type: float

Channel range: Unrestricted

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real and Complex

Output Pins

Name: out1

Description: audio output

Data type: float

MATLAB Usage

File Name: scaler_symmetric_fading_module.m

CODE
 M = scaler_symmetric_fading_module(NAME, ISCONTROL, NUMPINS)
 General purpose scaler module with a single gain applied across all
 channels.  The module can be configured for linear or dB operation
 as well as smoothed and unsmoothed gain changes. Arguments:
    NAME - name of the module.
    NUMPINS - number of input pins.  Default = 1.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.