Overview
Smoothly varying linear Fract32 scaler with independent gains in dB units
Discussion
Multichannel scaler, where each input channel has its own individual smoothly varying gain value. The gain parameter consists of an array of gains, one per input/output channel with units of dB. All gain parameters are exponentially smoothed (first order IIR) at the sample rate, with the smoothingTime parameter determining the smoothing rate for all of the gain values.
Type Definition
typedef struct _ModuleScalerNDBSmoothedFract32 { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure FLOAT32 smoothingTime; // Time constant of the smoothing process 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 FLOAT32* gainDB; // Array of gains, one per channel fract32* targetGain; // Array of gains, one per channel fract32* currentGain; // Array of instantaneous gains, one per channel } ModuleScalerNDBSmoothedFract32Class;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
smoothingTime | float | parameter | 0 | 10 | 0:1000 | msec |
smoothingCoeff | fract32 | derived | 1 | 0.002081 | Unrestricted | |
postShift | int | derived | 1 | 4 | Unrestricted | |
twoPowMinusPostShift | float | derived | 1 | 0.0625 | Unrestricted | |
gainDB | float* | parameter | 0 | [1 x 1] | -40:0.1:20 | dB |
targetGain | fract32* | derived | 0 | [1 x 1] | Unrestricted | |
currentGain | fract32* | state | 0 | [1 x 1] | Unrestricted |
Pins
Input Pins
Name: in
Description: Input signal
Data type: fract32
Channel range: Unrestricted
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: out
Description: Output signal
Data type: fract32
MATLAB Usage
File Name: scalern_db_smoothed_fract32_module.m
M=scalern_db_smoothed_fract32_module(NAME) Multichannel scaler module with individual control of gains in each channel. The gain controls are in dB units. Arguments: NAME - name of the module.