Overview
Module with different time delay for each channel specified in samples
Discussion
This time delay module has multiple input and multiple output channels. The delay in samples of each output channel can be independently set by the currentDelay array. The initial number of channels is specified at construction time and this also equals the length of the currentDelay array. Actual size of the currentDelay is updated in the prebuild function. Delays are specified in samples 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 delay in samples per channel is specified by the currentDelay array. Delays can be adjusted at run-time. The module applies smooth cross fading when adjusting the currentDelay at run-time.
Type Definition
Code Block |
---|
typedef struct _ModuleDelayNChanSmoothed { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure FLOAT32 smoothingTime; // Time constant of the cross fading process FLOAT32 oldGain; // Gain parameter for cross fading. FLOAT32 newGain; // Gain parameter for cross fading. INT32 fadingDone; // State variable to implement cross fading. INT32 maxDelay; // Maximum delay, in samples. INT32 stateHeap; // Heap in which to allocate memory. FLOAT32 smoothingCoeff; // Smoothing coefficient for cross fading. INT32* currentDelay; // Current delay per channel, in samples. INT32* stateIndex; // Index of the oldest state variable in the array of state variables. FLOAT32* state; // State variable array. INT32* prevDelay; // State array to implement cross fading. } ModuleDelayNChanSmoothedClass; |
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
smoothingTime | float | parameter | 0 | 10 | 0:1000 | msec |
oldGain | float | derived | 0 | 1 | Unrestricted | |
newGain | float | derived | 0 | 0 | Unrestricted | |
fadingDone | int | derived | 0 | 0 | 0:1 | |
maxDelay | int | const | 1 | 100 | Unrestricted | samples |
stateHeap | int | const | 1 | 561 | Unrestricted | |
smoothingCoeff | float | derived | 1 | 0.002081 | Unrestricted | |
currentDelay | int* | parameter | 0 | [1 x 1] | 0:100 | samples |
stateIndex | int* | state | 1 | [1 x 1] | Unrestricted | |
state | float* | state | 1 | [1 x 134] | Unrestricted | |
prevDelay | int* | state | 1 | [1 x 1] | Unrestricted |
Pins
Input Pins
Name: in
Description: audio input
...
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: out
Description: audio output
Data type: float
Scratch Pins
Channel count: 1
Block size: 32
Sample rate: 48000
MATLAB Usage
File Name: delaynchan_smoothed_module.m
...