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 module's .gain1 and .gain2 variables specify the target gains for the mixing process. The module's .currentGain1 and .currentGain2 variables 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
Code Block |
---|
typedef struct _ModuleSMixer2x1Fract32 { 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 fract32 targetGain1; // Fractional portion of the desired (or target) gain of the first channel fract32 currentGain1; // Fractional portion of the instantaneous gain of the first channel fract32 targetGain2; // Fractional portion of the desired (or target) gain of the second channel fract32 currentGain2; // Fractional portion of the instantaneous gain of the second channel 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 } ModuleSMixer2x1Fract32Class; |
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 |
targetGain1 | fract32 | derived | 1 | 0.0625 | Unrestricted | |
currentGain1 | fract32 | state | 1 | 0.0625 | Unrestricted | |
targetGain2 | fract32 | derived | 1 | 0.0625 | Unrestricted | |
currentGain2 | fract32 | state | 1 | 0.0625 | Unrestricted | |
smoothingCoeff | fract32 | derived | 1 | 0.002081 | Unrestricted | |
postShift | int | derived | 1 | 4 | Unrestricted | |
twoPowMinusPostShift | float | derived | 1 | 0.0625 | Unrestricted |
Pins
Input Pins
Name: in1
Description: audio input
...
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: out
Description: audio output
Data type: fract32
MATLAB Usage
File Name: smixer2x1_fract32_module.m
...