(8.D.2.7) ScalerNControl
Overview
Smooth scaler with independent gain per channel with gain (in linear units) is taken from an input pin
Discussion
The Scaler Control module smoothly scales multichannel input data by a independent gain value. The first pin is the control pin with gain values. The size of the control pin (i.e. number of gain values) is same as number of channels on input data. So the module has 2 input pins and 1 output pin 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 _ModuleScalerNControl
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
FLOAT32 smoothingTime; // Time constant of the smoothing process
FLOAT32 smoothingCoeff; // Smoothing coefficient
FLOAT32* currentGain; // Array of instantaneous linear gains, one per channel.
} ModuleScalerNControlClass;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
smoothingTime | float | parameter | 0 | 10 | 0:1000 | msec |
smoothingCoeff | float | derived | 1 | 0.002081 | Unrestricted | Â |
currentGain | float* | state | 0 | [1 x 1] | -10:10 | linear |
Pins
Input Pins
Name: g
Description: linear gain to apply
Data type: float
Channel range: Unrestricted
Block size range: 1
Sample rate range: Unrestricted
Complex support: Real
Â
Name: in
Description: Input signal
Data type: float
Channel range: Unrestricted
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: out
Description: Output signal
Data type: float
MATLAB Usage
File Name: scalern_control_module.m
M=scalern_control_module(NAME, NUMCHANNELS)
Creates a smoothly varying multi channel scaler module with gain as
control pin. The first pin is the control pin. Control pin has the same
number of channels as of audio pin to allow separate gain value per audio
channel.
Arguments:
NAME - name of the module.
NUMCHANNELS - Optional: number of channels. Normally determined
during pin propagation. By default, NUMCHANNELS = 1
Â