ScalerDBControl
Overview
Smooth scaler in which the gain (in dB) is taken from an input pin
Discussion
Scales all input channels by a single gain value. The first pin is the control pin. The gain (in dB) value is provided at the first sample of first pin. So the module has N+1 number of input pins and N number of output pins Internally, currentGain represents the instantaneous smoothed gain that is applied. currentGain exponentially approaches gain with a time constant equal to smoothingTime. 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.
Type Definition
typedef struct _ModuleScalerDBControl
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
FLOAT32 smoothingTime; // Time constant of the smoothing process
FLOAT32 currentGain; // Instantaneous gain applied by the module. This is also the starting gain of the module.
FLOAT32 smoothingCoeff; // Smoothing coefficient
} ModuleScalerDBControlClass;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
smoothingTime | float | parameter | 0 | 10 | 0:1000 | msec |
currentGain | float | state | 1 | 0 | Unrestricted | |
smoothingCoeff | float | derived | 1 | 0.002081 | Unrestricted |
Pins
Input Pins
Name: g
Description: gain (in dB)
Data type: float
Channel range: 1
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Real
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_db_control_module.m
M=scaler_db_control_module(NAME, NUMPINS)
Creates a smoothly varying scaler module which has variable number of
input and output pins and each pin can be multichannel and will
have the same gain applied to it. The first sample of first pin is used
as a target gain for the block. The first pin is the control pin.
The module can also be used to scale complex data. However, the smoothing
coefficient is ignored and no smoothing is performed in this case.
Arguments:
NAME - name of the module.
NUMPINS - number of audio input/output pins. By default, NUMPINS=1.