(8.D.2.2) ScalerControl
Overview
Smooth scaler in which the gain (in linear units) is taken from an input pin
Discussion
The Scaler Control module smoothly scales multichannel input data by a single gain value. The first pin is the control pin. The gain (in linear units) value is provided at the first sample of the 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.
Type Definition
typedef struct _ModuleScalerControl
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
FLOAT32 smoothingTime; // Time constant of the smoothing process
FLOAT32 currentGain; // Instantaneous gain applied by the module.
FLOAT32 smoothingCoeff; // Smoothing coefficient
} ModuleScalerControlClass;
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: linear gain to apply
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_control_module.m
M=scaler_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.
Â