Skip to content

MultiplexorFade

Discussion

THIS MODULE IS DEPRECATED AND NOT RECOMMENDED FOR NEW DESIGNS. PLEASE USE THE MultiplexorV2 MODULE INSTEAD.

This module seamlessly switches between input signals. The module has N input pins and 1 output pins. All inputs must have the same number of channels and the same block size. The number of channels and blockSize of the output pins equals the input pins.

The variable .index determines which input pin is routed to the output. .index is zero based and in the range [0 NUMIN-1]. If .index is outside of this range then it is clipped to the allowable range.

When .index is switched, the gain of the currently selected input pin is smoothly ramped from 1.0 to 0.0. The newly selected input pin is then smoothly ramped from 0.0 to 1.0 and added to the output. This essentially crossfades between the previously selected input and the new input. During the transition time the gain of the previously selected pin goes from 1.0 to 0.0. When this transition gain is below -40 dB then the transition is complete and from then on the selected .index pin is simplied copied to the output. This means that during the transition time the CPU load of the module may be slightly higher.

There are several related modules. multiplexor_module.m does the switching instantaneously without any smoothing. multiplexor_smoothed_module.m ramps the first gain from 1.0, mutes the module, and then ramps the newly selected pin from 0.0 to 1.0. multiplexor_smoothed_module.m has a slight drop out in the middle of the switching period and gives an audible indication that something has changed.

Module Pack

Deprecated

ClassID

classID = 2029

Type Definition

typedef struct _ModuleMultiplexorFade
{
ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
INT32 index;                                  // Specifies which input pin to route to the output. The index is zero based.
FLOAT32 smoothingTime;                        // Time constant of the smoothing process.
FLOAT32 smoothingCoeff;                       // Smoothing coefficient.
INT32 currentIndex;                           // This is the index that is currently being used and the module smoothly transitions to index.
FLOAT32 currentGain;                          // Instantaneous gain being applied. This is an internal variable used in the smoothing process.
} ModuleMultiplexorFadeClass;

Variables

Properties

Name Type Usage isHidden Default Value Range Units
index int parameter 0 0 0:2
smoothingTime float parameter 0 10 0:1000 msec
smoothingCoeff float derived 1 0.002081 Unrestricted
currentIndex int parameter 1 0 Unrestricted
currentGain float state 1 1 Unrestricted

Pins

Input Pins

Name in1
Description Input signal
Data type float
Channel range Unrestricted
Block size range Unrestricted
Sample rate range Unrestricted
Complex support Real
Name in2
Description Input signal
Data type float
Channel range Unrestricted
Block size range Unrestricted
Sample rate range Unrestricted
Complex support Real
Name in3
Description Input signal
Data type float
Channel range Unrestricted
Block size range Unrestricted
Sample rate range Unrestricted
Complex support Real

Output Pins

Name out
Description Output signal
Data Type float

Matlab Usage

File Name: multiplexor_fade_module.m 
 M=multiplexor_fade_module(NAME, NUMINPIN) 
 Creates a multiplexor module that seamlessly switches between inputs. 
 The module has multiple input pins and switches from one input to another. 
 Arguments: 
    NAME - name of the module. 
    NUMINPIN - number of input pins. 

 All input pins must have the same block size and number of channels. 

 Note, this version does a smooth crossfade between inputs.  See also: 
 multiplexor_module.m - no smoothing. 
 multiplexor_smoothed_module.m - ramps to zero and then unmutes. 

Copyright (c) 2026 DSP Concepts, Inc.