ScalerSymmetricFadingV2
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 interpreted 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 linear gain of 0 corresponds to -200dB. The same gain variable is used across signals. The module can also handle complex data but in the case of complex data no smoothing is performed and the gain value is applied to both the real and imaginary parts.
Module Pack
Standard
ClassID
classID = 242
Type Definition
typedef struct _ModuleScalerSymmetricFadingV2
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
FLOAT32 gain; // Gain in either linear or dB units.
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.
} ModuleScalerSymmetricFadingV2Class;
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 | 480 | Unrestricted | |
| targetGain | float | derived | 1 | 1 | Unrestricted | |
| prevGain | float | derived | 1 | 1 | Unrestricted | |
| currentGain | float | state | 1 | 1 | Unrestricted |
Pins
Input Pins
| Name | g |
| Description | gain to apply |
| Data type | float |
| Channel range | 1 |
| Block size range | Unrestricted |
| Sample rate range | Unrestricted |
| Complex support | Real |
| Name | in |
| 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 | out |
| Description | audio output |
| Data Type | float |
Matlab Usage
File Name: scaler_symmetric_fading_v2_module.m
M = scaler_symmetric_fading_v2_module(NAME, CONTROLPIN)
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.
CONTROLPIN - boolean indicating if there is a gain control pin. Default = 0.
Copyright (c) 2026 DSP Concepts, Inc.