ScalerControlBlockSmoothedFract32
Overview
Linear multichannel smoothly varying scaler with control pin
Discussion
Scales all input channels by the gain values taken from the first input pin. Changes to the gain parameter are exponentially smoothed (first order IIR) by the smoothingTime parameter on the block basis. Internally, currentGain represents the instantaneous smoothed gain that is applied. The module starts with a current gain equal to 0 and then slews towards the gain specified on the control input. The module supports multiple input and output pins and the number of pins is specified by the second argument NUMPINS. By default, NUMPINS = 1. All audio inputs and outputs are in fract32 format. The processing function is implemented using a fractional multiply by the smoothed gain followed by a fixed bit right-shift at the end.
The module argument DATATYPE specifies the data type of the control input. DATATYPE = 0 (the default) indicates that the control pin will be fractional with Q9.23 format. Alternatively, if DATATYPE = 1 then the control input is a floating-point value.
The control input can have any block size and any number of channels. The module uses the first sample value of the control pin at the target gain; all other values are ignored.
Type Definition
typedef struct _ModuleScalerControlBlockSmoothedFract32
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
FLOAT32 smoothingTime; // Time constant of the smoothing process
INT32 dataType; // Specifies data type at input control pin (0=Q9.31, 1=float)
fract32 currentGain; // Instantaneous gain applied by the module. This is also the starting gain of the module.
fract32 smoothingCoeff; // Smoothing coefficient
} ModuleScalerControlBlockSmoothedFract32Class;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
smoothingTime | float | parameter | 0 | 10 | 0:1000 | msec |
dataType | int | const | 0 | 0 | Unrestricted | |
currentGain | fract32 | state | 1 | 0 | Unrestricted | linear |
smoothingCoeff | fract32 | derived | 1 | 0.002081 | Unrestricted |
Pins
Input Pins
Name: g
Description: gain input
Data type: fract32
Channel range: 1
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Real
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_control_block_smoothed_fract32_module.m
M=scaler_control_block_smoothed_fract32_module(NAME, NUMPINS, DATATYPE)
The scaler operates on fractional 32-bit values. The scaler
accepts multichannel input and scales all channels by the same
value. The input and output audio signals are in standard fract32
format (Q1.31). Arguments:
NAME - name of the module.
NUMPINS - number of input and output audio pins (default = 1)
DATATYPE - data type of the control signal. You can select
between Q9.23 (DATATYPE = 0, the default) or floating-point
(DATATYPE = 1)
Copyright 2014. DSP Concepts, Inc. All Rights Reserved.