(8.D.1.2) Delay
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
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
Data type: {float, int, fract32}
Channel range: Unrestricted
Block size range: Unrestricted
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
M=delay_module(NAME, MAXDELAY, MEMHEAP)
Creates an integer time delay for use in the Audio Weaver environment.
Arguments:
NAME - name of the module.
MAXDELAY - maximum delay, in samples.
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 (the default).
'AWE_HEAP_FAST2SLOW' - use internal memory. If this fails
then use external memory (the default).
Â