(8.D.2.3) 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, where the gain (in linear units) values for the module will be obtained from. If the input data is complex or there is only one gain value per block, the same gain value will be applied accross all channels (obtained from the first sample). However, if the data is real and the control pin gets more than one value per block (aka block size is greater than 1), the input data will be divided into blocks of data, one per gain value. Each block will be scaled sequentially by each gain value. This could be used, for example, to scale different bin magnitudes by different values. The module has one more input pin compared to number of output pins as a result of the control pin. Internally, currentGain represents the instantaneous smoothed gain that is applied. currentGain exponentially approaches gain with a time constant equal to smoothingTime.
Note: when the module is used to scale complex data no smoothing is performed and the gain value is applied to both the real and imaginary parts.
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. The first pin is
the control pin, where the gain values will be obtained from. If the
data is complex or there is only one gain value per block, the same gain
value will be applied accross all channels. However, if the data is real
and the control pin gets more than one value, the input data will be
divided into blocks of data, one per gain value. Each block will
be scaled sequentially by each gain value. This could be used, for
example, to scale different bin magnitudes by different values. Note:
when the module is used to scale complex data, 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.
Â