Skip to content

CrossFader

Overview

Cross fader

Discussion

The Cross Fader module mixes two signals according to a Control value. The module has three inputs. The Control is implemented in first which is a scalar value from 0 to 1. The other two inputs are the audio inputs A and B. The output corresponds to the weighted addition of signals A and B according to the Control value. If the Control is 0, then the output equals A. If the Control equals 1, the output equals B.

Module Pack

Standard

ClassID

classID = 18

Type Definition

typedef struct _ModuleCrossFader
{
ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
FLOAT32 smoothingTime;                        // Time constant of the smoothing process
INT32 mixType;                                // Selects the type of curve: Linear=0, Energy=1.
FLOAT32 currentGainA;                         // Instantaneous gain applied to channel A.
FLOAT32 currentGainB;                         // Instantaneous gain applied to channel B.
FLOAT32 smoothingCoeff;                       // Smoothing coefficient
} ModuleCrossFaderClass;

Variables

Properties

Name Type Usage isHidden Default Value Range Units
smoothingTime float parameter 0 10 0:1000 msec
mixType int parameter 0 0 0:1
currentGainA float state 1 0.5 0:1
currentGainB float state 1 0.5 0:1
smoothingCoeff float derived 1 0.002081 Unrestricted

Pins

Input Pins

Name g
Description cross-fader value
Data type float
Channel range 1
Block size range Unrestricted
Sample rate range Unrestricted
Complex support Real
Name inA
Description audio input A
Data type float
Channel range Unrestricted
Block size range Unrestricted
Sample rate range Unrestricted
Complex support Real
Name inB
Description audio input B
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: cross_fader_module.m 
 M=cross_fader_module(NAME) 
 Creates a cross fader module for Audio Weaver. 

 Arguments: 
    NAME - name of the module. 

Copyright (c) 2026 DSP Concepts, Inc.