(8.D.2.2) MuteLinearFade
Overview
Smoothly mutes and unmutes with Linear Fade
Discussion
Smoothly mutes (fade out) all input channels. FadeOut/FadeIn is controlled by the fadeOut parameter. The fadeOut parameter is automatically converted to a value for the internal gain variable: fadeOut = 1 --> gain = 0 or fadeOut = 0 --> gain = 1. The variable gain serves as a target gain for the module. Changes made to the gain variable are smoothed by the linear fade with the time constant determined by the fadeOutTime and fadeInTime parameters. The internal variable currentGain represents the instantaneous smoothed gain that is applied to the data stream. currentGain approaches to gain with a time constant equal to fadeOutTime or fadeInTime. The module has separate time parameters for fadeOut and fadeIn. When the fadeOut is requested, the module outputs 0 on control output pin and once the currentGain == gain then the module outputs 1 on the control output pin.
currentGain also serves as the starting gain of the module. If currentGain = gain, then the module starts up in a converged state. If currentGain != gain, then the module will smoothly vary the gain at startup.
Type Definition
typedef struct _ModuleMuteLinearFade
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
INT32 fadeOut; // Boolean that controls muting/unmuting.
FLOAT32 fadeOutTime; // Time constant of the fade out (mute) process.
FLOAT32 fadeInTime; // Time constant of the fade in (unmute) process.
INT32 faderState; // State of the fader ramp. 0 - fader in/out is in progress and 1 - fading is done.
FLOAT32 currentGain; // Instantaneous gain applied by the module. This is also the starting gain of the module.
FLOAT32 fadeOutCoeff; // Fade out coefficient.
FLOAT32 fadeInCoeff; // Fade in coefficient.
FLOAT32 gain; // Target gain.
} ModuleMuteLinearFadeClass;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
fadeOut | int | parameter | 0 | 0 | 0:1 | Â |
fadeOutTime | float | parameter | 0 | 10 | 0:1000 | msec |
fadeInTime | float | parameter | 0 | 10 | 0:1000 | msec |
faderState | int | state | 0 | 0 | Unrestricted | Â |
currentGain | float | state | 1 | 1 | 0:1 | linear |
fadeOutCoeff | float | derived | 1 | 0.002081 | Unrestricted | Â |
fadeInCoeff | float | derived | 1 | 0.002081 | Unrestricted | Â |
gain | float | derived | 1 | 1 | 0:1 | linear |
Pins
Input Pins
Name: in
Description: audio input
Data type: float
Channel range: Unrestricted
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: out
Description: audio output
Data type: float
Â
Name: FS
Description: boolean fader state
Data type: int
MATLAB Usage
File Name: mute_linear_fade_module.m
M=mute_linear_fade_module(NAME)
Creates a module which smoothly mutes and unmutes with different fade out
and fade in time parameters.
Arguments:
NAME - name of the module.
Â