DelayMixerSmoothed
Overview
A smoothed mixer module with M outputs and N inputs
Discussion
This implements the same functionality as MultiChannelMixerSmoothed module, but is significantly more efficient, both in speed and memory.
This time delay module has multiple input and multiple output channels with real data only. Smoothed delay can be applied at each intersections of the input and output lines. The delays and gains to be applied at each intersection comes from the control pin in interleaved order gainIn1Out1, delayIn1Out1, gainIn2Out1, delayIn2Out1 and so on. Delays are specified in milliseconds and are in the range of [0 MAXDELAY].
At construction time, you specify the maximum delay (maxDelay) of the module. The variable, maxDelay determines the size of the internal state buffer. The size of the internal state buffer equals (maxDelay+1)*numChannels samples. The module applies smooth cross fading when delay or gain values are changed at run-time.
When the module is bypassed, it copies the ith input channel to the ith output channel. If the module has more output channels than input channels, the remaining output channels are set to 0.
Type Definition
typedef struct _ModuleDelayMixerSmoothed
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
FLOAT32 maxDelayTime; // Maximum delay, in milliseconds.
FLOAT32 smoothingTimeDelay; // Time constant of the cross fading process of delay
FLOAT32 smoothingTimeGain; // Time constant of the cross fading process of gain
FLOAT32 smoothingCoeff; // Smoothing coefficient for cross fading of delays.
FLOAT32 smoothingCoeffGain; // Smoothing coefficient for cross fading of gains.
INT32 stateHeap; // Heap in which to allocate memory.
INT32 maxDelay; // Max delay in samples.
INT32* prevDelay; // Array holding previous delay values.
INT32* currentDelay; // Array holding current delay values.
FLOAT32* prevGain; // Array holding previous gain values.
FLOAT32* currentGain; // Array holding current gain values.
FLOAT32* oldGain; // Gain parameter for cross fading of delay.
FLOAT32* newGain; // Gain parameter for cross fading of delay.
INT32* fadingDone; // State variable to implement cross fading of delay.
INT32* stateIndex; // Index of the oldest state variable in the array of state variables.
FLOAT32* state; // State variable array.
} ModuleDelayMixerSmoothedClass;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
maxDelayTime | float | const | 0 | 10 | 0:10 | msec |
smoothingTimeDelay | float | parameter | 0 | 10 | 0:1000 | msec |
smoothingTimeGain | float | parameter | 0 | 10 | 0:1000 | msec |
smoothingCoeff | float | derived | 1 | 0.002081 | Unrestricted | |
smoothingCoeffGain | float | derived | 1 | 0.002081 | Unrestricted | |
stateHeap | int | const | 1 | 561 | Unrestricted | |
maxDelay | int | const | 1 | 480 | Unrestricted | |
prevDelay | int* | state | 1 | [1 x 1] | Unrestricted | samples |
currentDelay | int* | state | 1 | [1 x 1] | Unrestricted | samples |
prevGain | float* | state | 1 | [1 x 1] | Unrestricted | samples |
currentGain | float* | state | 1 | [1 x 1] | Unrestricted | samples |
oldGain | float* | state | 1 | [1 x 1] | Unrestricted | |
newGain | float* | state | 1 | [1 x 1] | Unrestricted | |
fadingDone | int* | state | 1 | [1 x 1] | 0:1 | |
stateIndex | int* | state | 1 | [1 x 1] | Unrestricted | |
state | float* | state | 1 | [1 x 515] | Unrestricted |
Pins
Input Pins
Name: in
Description: audio input
Data type: float
Channel range: Unrestricted
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Real
Name: cntrl
Description: Control pin for MxN gain and delays
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
Scratch Pins
Channel count: 1
Block size: 64
Sample rate: 48000
Channel count: 1
Block size: 32
Sample rate: 48000
MATLAB Usage
File Name: delay_mixer_smoothed_module.m
M=delay_mixer_smoothed_module(NAME, NUMCHANNELS, MAXDELAY, MEMHEAP)
Creates a multi-channel time delay in which the delay times are specified
in milliseconds. The module has a multichannel input pin
and an multichannel output pin. Each output channel is a mix of all the
input channels with a dedicated delay and mix level for each input channel.
The module applies smooth transition between delay time
changes as well as mixer levels.
Arguments:
NAME - name of the module.
NUMCHANNELS - number of output channels for the module.
MAXDELAY - maximum delay, in milliseconds.
MEMHEAP - specifies the memory heap to use to allocate the main
state buffer. This is a string and follows the memory allocation
enumeration in Framework.h. Allowable values are:
'AWE_HEAP_FAST' - always use internal DM memory.
'AWE_HEAP_FASTB' - always use internal PM memory.
'AWE_HEAP_SLOW' - always use external memory.
'AWE_HEAP_FAST2SLOW' - use internal memory. If this fails
then use external memory (the default).
'AWE_HEAP_FASTB2SLOW' - use internal memory. If this fails
then use external memory.