Overview
Time delay in which the delay is specified in samples
Discussion
A delay module, where the delay is specified as an integer number of samples. The delay is implemented such that delays as short as 0 samples can be realized. The module has one multichannel input and one multichannel output. The module can operate on multiple channels and applies the same delay to each channel.
At construction time, 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*numChannels. In addition, the instantaneous delay is specified through the interface variable, currentDelay. currentDelay is in the range of [0 maxDelay] and can be changed at run-time. Note that the module is not smoothly updating and you may get audible clicks when adjusting the currentDelay at run-time.
Type Definition
Code Block |
---|
typedef struct _ModuleDelay { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure INT32 maxDelay; // Maximum delay, in samples. The size of the delay buffer is maxDelay*numChannels. INT32 currentDelay; // Current delay. INT32 stateIndex; // Index of the oldest state variable in the array of state variables. INT32 stateHeap; // Heap in which to allocate memory. FLOAT32* state; // State variable array. } ModuleDelayClass; |
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
maxDelay | int | const | 0 | 100 | Unrestricted | samples |
currentDelay | int | parameter | 0 | 0 | 0:1:100 | samples |
stateIndex | int | state | 1 | 0 | Unrestricted | |
stateHeap | int | const | 1 | 2 | Unrestricted | |
state | float* | state | 1 | [1 x 101] | 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, int, fract32}
MATLAB Usage
File Name: delay_module.m
...