Document toolboxDocument toolbox

MuteSync

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.

Set the .asyncCommand or .syncCommand variable to 1 (UNMUTE) to change gain smoothly to 0 after unmuteTime ms. Set to 2 (MUTE) to change gain to 1 after muteTime ms. When asyncCommand is set, the set function returns immediately. When changing syncCommand, the set function returns only after the target has been reached.

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

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

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

MATLAB Usage

File Name: mute_sync_module.m

M=mute_sync_module(NAME, DEFSYNC, GAINPIN) Create an extended floating-point smoothed mute module that supports a group of synchronous variables for which the set function returns only when the requested mute or unmute operation has completed. Muting and muting smoothing is performed using raised cosine windows as in MuteUnmute so that the gain reaches 0 or 1 after the specified time constant. NAME The name of the module DEFSYNC Turns synchronous muting on/off (default = 1 = ON) GAINPIN Indicator for adding a gain output pin (default = 0 = OFF) Copyright 2010-2016 DSP Concepts, Inc. All rights reserved.

Â