Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The Scaler Control module smoothly scales multichannel input data by a single gain value. The first pin is the control pin. The , where the gain (in linear units) value is provided at the first sample of the first pin. So the module has N+1 number of input pins and N number of output pins values for the module will be obtained from. If the input data is complex or there is only one gain value per block, the same gain value will be applied accross all channels (obtained from the first sample). However, if the data is real and the control pin gets more than one value per block (aka block size is greater than 1), the input data will be divided into blocks of data, one per gain value. Each block will be scaled sequentially by each gain value. This could be used, for example, to scale different bin magnitudes by different values. The module has one more input pin compared to number of output pins as a result of the control pin. Internally, currentGain represents the instantaneous smoothed gain that is applied. currentGain exponentially approaches gain with a time constant equal to smoothingTime.

Note: when the module is used to scale complex data no smoothing is performed and the gain value is applied to both the real and imaginary parts.

Type Definition

Code Block
typedef struct _ModuleScalerControl
{
    ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
    FLOAT32 smoothingTime;                        // Time constant of the smoothing process
    FLOAT32 currentGain;                          // Instantaneous gain applied by the module.
    FLOAT32 smoothingCoeff;                       // Smoothing coefficient
} ModuleScalerControlClass;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

smoothingTime

float

parameter

0

10

0:1000

msec

currentGain

float

state

1

0

Unrestricted

smoothingCoeff

float

derived

1

0.002081

Unrestricted

Pins

Input Pins

Name: g

Description: linear gain to apply

...

Code Block
 M=scaler_control_module(NAME,NUMPINS)
 Creates a smoothly varying scaler module which has variable number of 
 input and output pins and each pin can be multichannel. The andfirst willpin is 
have the samecontrol pin, where the gain values will appliedbe toobtained itfrom. The firstIf samplethe of
first pindata is usedcomplex or there asis aonly targetone gain for value per block, the block. The first pin issame gain
 value will be applied accross all channels.  However, if the data is real
 and the control pin gets more than one value, the input data will be
 divided into blocks of data, one per gain value.  The module can also be Each block will 
 be scaled sequentially by each gain value. This could be used, for
 example, to scale different bin magnitudes by different values. Note: 
 when the module is used to scale complex data. However, the smoothing coefficient coefficient
 is ignored and no smoothing is performed in this case.
   Arguments:
    NAME - name of the module.
    NUMPINS - number of audio input/output pins.  By default, NUMPINS=1.

...