ScalerNSmoothedFract32
Overview
Smoothly varying linear scaler Fract32 module with independent gains
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. 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.
ScalerNFract32 is an unsmoothed version of this module.
Type Definition
typedef struct _ModuleScalerNSmoothedFract32
{
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* gain; // Array of gains, one per channel
fract32* targetGain; // Array of gains, one per channel
fract32* currentGain; // Array of instantaneous gains, one per channel
} ModuleScalerNSmoothedFract32Class;
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 | |
gain | float* | parameter | 0 | [1 x 1] | -10:10 | linear |
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_smoothed_fract32_module.m
M=scalern_smoothed_fract32_module(NAME)
The scaler operates on fractional 32-bit values. By default, the scaler
has a single multichannel input and scales all channels by the same
value. Arguments:
NAME - name of the module.