SMixer2x1
Overview
2-input x 1-output smoothly varying mixer module
Discussion
Mixes 2 inputs into a single output. The mixing gain parameters are exponentially smoothed (first order IIR) at the sample rate, with the smoothingTime parameter determining the smoothing rate for both of the gain values. The variables, gain1 and gain2, specify the target gains for the mixing process. The variables, currentGain1 and currentGain2, specify the instantaneous gains applied, and these exponentially approach the target gains. At build time, currentGain1 is set to gain1 and currentGain2 is set to gain2. This causes the mixers to startup in a converged state.
Type Definition
typedef struct _ModuleSMixer2x1
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
FLOAT32 gain1; // Desired gain applied to first input channel.
FLOAT32 gain2; // Desired gain applied to second input channel.
FLOAT32 smoothingTime; // Time constant of the smoothing process.
FLOAT32 currentGain1; // Instantaneous gain for the first input channel.
FLOAT32 currentGain2; // Instantaneous gain for the second input channel.
FLOAT32 smoothingCoeff; // Smoothing coefficient.
} ModuleSMixer2x1Class;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
gain1 | float | parameter | 0 | 1 | -10:10 | |
gain2 | float | parameter | 0 | 1 | -10:10 | |
smoothingTime | float | parameter | 0 | 10 | 0:1000 | msec |
currentGain1 | float | state | 1 | 1 | -10:10 | linear |
currentGain2 | float | state | 1 | 1 | -10:10 | linear |
smoothingCoeff | float | derived | 1 | 0.002081 | Unrestricted |
Pins
Input Pins
Name: in1
Description: audio input
Data type: {float, int, fract32}
Channel range: Unrestricted
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Real
Name: in2
Description: audio input
Data type: {float, int, fract32}
Channel range: Unrestricted
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: out
Description: audio output
Data type: {float, int, fract32}
MATLAB Usage
File Name: smixer2x1_module.m
M=smixer2x1_module(NAME)
Creates a 2-input 1-output smoothly varying mixer for use in the Audio
Weaver environment.
Arguments:
NAME - name of the module.
The module automatically determines the dataType based on the dataType of
the input pin. You can explicitly set the data type using an optional
second argument:
M=smixer2x1_module(NAME, DATATYPE)
where DATATYPE is: 'float' or 'fract32'. Explicitly setting the DATATYPE
is only required for code generation.