(8.D.2.6) ScalerDBSmoothedFract32
Overview
Linear multichannel smoothly varying dB scaler
Discussion
The Scaler DB Smoothed module smoothly scales multichannel input data by a single gain value specified in dB, (gainDB). The module will have input and output pin pairs as determined by the numPins value, with each output pin having the same dimensions as the input pin. gainDB is automatically converted to a linear value: gain. Changes to the gain parameter are exponentially smoothed (first order IIR) at the sample rate, with the time constant determined by the smoothingTime parameter. This module is controlled by varying the gainDB variable. gainDB is then converted to gain. Internally, currentGain represents the instantaneous smoothed gain that is applied. currentGain exponentially approaches gain with a time constant equal to smoothingTime. currentGain also serves as the starting point of the module. If currentGain = gain then the module starts up in a converged state. If currentGain != gain then the module will smoothly vary the gain at startup.
Type Definition
typedef struct _ModuleScalerDBSmoothedFract32
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
FLOAT32 smoothingTime; // Time constant of the smoothing process
FLOAT32 gainDB; // Target gain in DB
fract32 targetGain; // Desired (or target) of the fractional portion of the overall scaling. This is also the starting gain of the module.
fract32 currentGain; // Instantaneous gain applied by the module. This is also the starting gain of the module.
fract32 smoothingCoeff; // Smoothing coefficient
INT32 postShift; // Number of bits to shift after the fractional multiply. This is based on gain.range.
FLOAT32 twoPowMinusPostShift; // 2^(-postShift). Used by to streamline the operation of the set function
} ModuleScalerDBSmoothedFract32Class;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
smoothingTime | float | parameter | 0 | 10 | 0:1000 | msec |
gainDB | float | parameter | 0 | 0 | -40:0.1:20 | dB |
targetGain | fract32 | derived | 1 | 0.0625 | Unrestricted | Â |
currentGain | fract32 | state | 1 | 0.0625 | Unrestricted | Â |
smoothingCoeff | fract32 | derived | 1 | 0.002081 | Unrestricted | Â |
postShift | int | derived | 1 | 4 | Unrestricted | Â |
twoPowMinusPostShift | float | derived | 1 | 0.0625 | Unrestricted | Â |
Pins
Input Pins
Name: in1
Description: audio input
Data type: fract32
Channel range: Unrestricted
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: out1
Description: audio output
Data type: fract32
MATLAB Usage
File Name: scaler_db_smoothed_fract32_module.m
M=scaler_db_smoothed_fract32_module(NAME, NUMPINS)
Creates a smoothed dB scaler for use in the
Audio Weaver. The module has a single multichannel
input and scales all channels by the same value.
Arguments:
NAME - name of the module.
NUMPINS - number of pins, optional (default=1)
Â