Document toolboxDocument toolbox

InvertN

Overview

Phase invert module

Discussion

This module inverts the phase of a signal. Inverting the phase is simply multiplying by -1. When the second argument NUMPINS is 1, then the phase invert control is applied to each individual channel. Otherwise the phase invert control is applied to each individual input pin as a whole. The array .isInverted is used for phase invert control. The array length is updated by the prebuild function.

The module uses a first order smoother to seamlessly switch between +1 and -1. The speed of the smoothing operation is set by the .smoothingTime variable. The module's set function translates the smoothingTime to an internal smoothingCoeff. When the module is built it starts out in a converged state.

By default, the inspector for the module has the control checkboxes organized in a vertical stack. By setting the optional third argument TRANSPOSE = 1 turns the control into a horizontal stack.

Type Definition

typedef struct _ModuleInvertN { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure INT32 numControls; // Number of individual invert controls FLOAT32 smoothingTime; // Time constant of the smoothing process FLOAT32 smoothingCoeff; // Smoothing coefficient. INT32* isInverted; // Boolean that specifies whether the signal is inverted (=1) or not (=0). One per each pin. FLOAT32* currentGain; // Instantaneous gain applied by the module. This is also the starting gain of the module. FLOAT32* gain; // Target gain. } ModuleInvertNClass;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

numControls

int

const

0

1

Unrestricted

 

smoothingTime

float

parameter

0

10

0:1000

msec

smoothingCoeff

float

derived

1

0.002081

Unrestricted

 

isInverted

int*

parameter

0

[1 x 1]

0:1

 

currentGain

float*

state

1

[1 x 1]

-1:1

linear

gain

float*

derived

1

[1 x 1]

-1:1

linear

Pins

Input Pins

Name: in1

Description: audio input

Data type: float

Channel range: Unrestricted

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: out1

Description: audio output

Data type: float

MATLAB Usage

File Name: invertn_module.m

M=invertn_module(NAME, NUMPINS, NUMCHANNELS, TRANSPOSE) Creates a module which inverts the phase of a signal (that is, sets the gain equal to -1). The change happens smoothly with a specified smoothing time. Arguments: NAME - name of the module. NUMPINS - optional argument that specifies the number of input pins. When NUMPINS is 1, the invert control apply to each individual channel within the input pin. When NUMPINS is more than 1, the invert control apply to those input pins. NUMCHANNELS - optional argument that specifies the initial number of channels in the wire. When the system is built, the number of channels is derived by pin propagation. This value is only for the initial behavior before the system is built. By default, NUMCHANNELS = 2. TRANSPOSE - an optional argument which controls how the inspector for the module is drawn. By default, if there are N channels then the inspector control is a vertical stack of N checkboxes. (TRANSPOSE = 0 by default). If TRANSPOSE = 1, then the inspector is drawn as a horizontal array of N checkboxes. AudioWeaverModule [This tag makes it appear under awe_help]

Â