Document toolboxDocument toolbox

MuteSyncFract32

Overview

Fixed-point smoothed 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 computethe gain profile for the raised cosine.

Type Definition

typedef struct _ModuleMuteSyncFract32 { 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 fract32 currentGain; // Gain being applied to start of next sample block fract32 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 fract32 muteRotateR; // Real part of multiplier to rotate phasor while muting fract32 unmuteRotateR; // Real part of multiplier to rotate phasor while unmuting fract32 unmuteRotateI; // Imaginary part of multiplier to rotate phasor while unmuting fract32 phasorR; // Real part of complex phasor used to compute cosine fract32 phasorI; // Imaginary part of complex phasor used to compute cosine INT32 sampleTime; // Counts samples since the start of the active mute or unmute operation } ModuleMuteSyncFract32Class;

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

fract32

derived

0

0

Unrestricted

 

muteRotateI

fract32

derived

0

0.01309

Unrestricted

 

syncState

int

derived

1

1

Unrestricted

 

muteSamples

int

derived

1

240

Unrestricted

 

unmuteSamples

int

derived

1

2400

Unrestricted

 

muteRotateR

fract32

derived

1

0.9999

Unrestricted

 

unmuteRotateR

fract32

derived

1

1

Unrestricted

 

unmuteRotateI

fract32

derived

1

0.001309

Unrestricted

 

phasorR

fract32

state

1

0

Unrestricted

 

phasorI

fract32

state

1

0

Unrestricted

 

sampleTime

int

state

1

0

Unrestricted

 

Pins

Input Pins

Name: in

Description: audio input

Data type: fract32

Channel range: Unrestricted

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: out

Description: audio output

Data type: fract32

MATLAB Usage

File Name: mute_sync_fract32_module.m

M = mute_sync_fract32_module(NAME, DEFSYNC, GAINPIN) Create an extended fixed-point smoothed mute module that supports a group of synchronous variables for which the set returns only when the resquested 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. Arguments: 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.

Â