Overview
Smooth mute with synchronous requests
Discussion
Smoothly change the gain of all input channels to 0 (mute) or 1 (unmute). You have full control over the time that it takes to mute and unmute. Gain values applied are available on an optional second output pin.
...
The module uses a raised cosine window for muting and unmuting. For memory efficiency the module uses a complex recursion to compute the gain profile for the raised cosine.
Type Definition
Code Block |
---|
typedef struct _ModuleMuteSync { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure INT32 isMuted; // Boolean for target gain: 1 means silence INT32 asyncCommand; // Start changing the gain without waiting for completion: 1=unmute, 2=mute INT32 syncCommand; // Change the gain and return only when finished: 1=unmute, 2=mute FLOAT32 muteTime; // Muting time in msec FLOAT32 unmuteTime; // Unmuting time in msec INT32 compatSync; // When true, isMuted compatibility is synchronous INT32 muteState; // Current muting action: 0=not set, 1=unmuted, 2=muted, 3=unmute changing, 4=mute changing FLOAT32 currentGain; // Gain being applied to start of next sample block FLOAT32 muteRotateI; // Imaginary part of multiplier to rotate phasor while muting INT32 syncState; // Active synchronous target state INT32 muteSamples; // Muting time in samples INT32 unmuteSamples; // Unmuting time in samples FLOAT32 muteRotateR; // Real part of multiplier to rotate phasor while muting FLOAT32 unmuteRotateR; // Real part of multiplier to rotate phasor while unmuting FLOAT32 unmuteRotateI; // Imaginary part of multiplier to rotate phasor while unmuting FLOAT32 phasorR; // Real part of complex phasor used to compute cosine FLOAT32 phasorI; // Imaginary part of complex phasor used to compute cosine INT32 sampleTime; // Counts samples since the start of the active mute or unmute operation } ModuleMuteSyncClass; |
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
isMuted | int | state | 0 | 0 | 0:1 | |
asyncCommand | int | state | 0 | 0 | 0:2 | |
syncCommand | int | state | 0 | 0 | 0:2 | |
muteTime | float | parameter | 0 | 5 | 1:1000 | |
unmuteTime | float | parameter | 0 | 50 | 1:1000 | |
compatSync | int | state | 0 | 1 | Unrestricted | |
muteState | int | state | 0 | 1 | 0:4 | |
currentGain | float | derived | 0 | 1 | Unrestricted | |
muteRotateI | float | derived | 0 | 0.01309 | Unrestricted | |
syncState | int | derived | 1 | 1 | Unrestricted | |
muteSamples | int | derived | 1 | 240 | Unrestricted | |
unmuteSamples | int | derived | 1 | 2400 | Unrestricted | |
muteRotateR | float | derived | 1 | 0.9999 | Unrestricted | |
unmuteRotateR | float | derived | 1 | 1 | Unrestricted | |
unmuteRotateI | float | derived | 1 | 0.001309 | Unrestricted | |
phasorR | float | state | 1 | 0 | Unrestricted | |
phasorI | float | state | 1 | 0 | Unrestricted | |
sampleTime | int | state | 1 | 0 | Unrestricted |
Pins
Input Pins
Name: in
Description: audio input
...
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: out
Description: audio output
Data type: float
MATLAB Usage
File Name: mute_sync_module.m
...