Document toolboxDocument toolbox

(8.D.2.3) RouterSmoothedFract32

Overview

Smoothly varying channel router module

Discussion

This module routes (or copies) an arbitrary collection of input pins to a single multichannel output pin. Each input pin can have an arbitrary number of interleaved channels, but they must all have the same block size. The array channelIndex specifies the mapping from input pin/channel to the output pin/channel. The array has the same length as the number of output channels and the kth array value specifies the mapping from the input pins to the kth output channel. Each array value is a 32-bit packed integer. The high 16 bits represents the input pin number (zero-based) and the low 16 bits represent the channel number (zero-based) to select. If the pin index or channel index is out of range, then the particular output channel is muted. For example, you can mute a channel by setting the index to -1 (unless, of course, you happen to have 65536 pins and 65536 channels). When a router is first instantiated, all of the channel index values are -1.

This channelIndex of this module can be modified at run-time without introducing audible clicks. Internally, the module smooths transitions using the following algorithm. When the channelIndex is first modified, the module maintains the input to output channel mapping and smoothly ramps the gain from 0 dB to -100 dB. Then, when the gain is at -100 dB, the module switches the channelIndex and starts copying the newly selected input channel. The switching transition occurs when the gain is at -100 dB. After switching the channels, the module smoothly unmutes from -100 dB to 0 dB.

The smoothingTime parameter adjusts the rate of smoothing. Typically, values in the range of 10 msec are adequate.

Note that this module is smoothly varying. If you need a more efficient unsmoothed implementation, use the router_module.m instead.

Type Definition

typedef struct _ModuleRouterSmoothedFract32 { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure FLOAT32 smoothingTime; // Time constant of the smoothing process fract32 smoothingCoeffFract32; // Smoothing coefficient INT32* channelIndex; // Specifies input to output channel routing. Each item in the array corresponds to an output pin and contains two packed values: input pin number in the high 16 bits; input channel number in the low 16 bits INT32* currentChannelIndex; // Similar to the channelIndex, but specifies the current routing for each channel fract32* currentGain; // Instantaneous gain for each output channel } ModuleRouterSmoothedFract32Class;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

smoothingTime

float

parameter

0

10

0:1000

msec

smoothingCoeffFract32

fract32

derived

1

0.002081

Unrestricted

 

channelIndex

int*

parameter

0

[1 x 1]

Unrestricted

 

currentChannelIndex

int*

state

1

[1 x 1]

Unrestricted

 

currentGain

fract32*

state

1

[1 x 1]

Unrestricted

 

Pins

Input Pins

Name: in1

Description: Input signal

Data type: fract32

Channel range: Unrestricted

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real and Complex

 

Name: in2

Description: Input signal

Data type: fract32

Channel range: Unrestricted

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real and Complex

Output Pins

Name: out

Description: Output signal

Data type: fract32

MATLAB Usage

File Name: router_smoothed_module.m

M=router_smoothed_fract32_module(NAME, NUMINPIN, NUMOUTCHANNEL) Creates a smoothly varying fixed-point router module which selects channels from multiple input pins and combines them into a single multichannel output. No audible clicks occur when switching between channel due to sample-by-sample smoothing. This modules works in the Audio Weaver environment. Arguments: NAME - name of the module. NUMINPIN - number of input pins. NUMOUTCHANNEL - number of interleaved outputs. There is a single output pin.

Â