Overview
Time delay with 16-bit samples
Discussion
Delay module in which samples values are stored as 16-bit data. This module is similar to delay_module.m except that it uses less precision - and less - memory. The delay time is specified in samples and the same delay time is used across channels.
This module differs from the standard Delay module in that sample values are stored as 16-bit values. The module takes the high 16-bits for fract32 and int32 samples. For floating-point, values are first converted to fract32 and then the high 16-bits are taken. Floating-point data outside of the range [-1 +1) is clipped. For the case of floating-point, the fract16 samples are converted back to floating-point. ... 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+1)*numChannels + 1)/2 words. 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 _ModuleDelay16 { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure INT32 maxDelay; // Maximum delay, in samples. 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. INT32 isFloat; // Boolean that indicates whether the data is floating-point and needs to be converted. INT32* state; // State variable array. } ModuleDelay16Class; |
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 | 3 | Unrestricted | |
isFloat | int | parameter | 1 | 1 | Unrestricted | |
state | int* | state | 1 | [51 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, int, fract32}
MATLAB Usage
File Name: delay16_module.m
...