Overview
Sample-based time delay
Discussion
An allpass fractional 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. The delay line is incorporated into a first order allpass topology (transposed Direct Form II), with the feedback gain determined by the coef value, and the feedforward gain determined by -coef.
At construction time, you specify the maximum delay (maxDelay) of the module. maxDelay determines the size of the internal state buffer. To be precise, the size of the internal state buffer equals (maxDelay+1)*numChannels. In addition, you specify the instantaneous delay through the interface variable .currentDelay. currentDelay is in the range [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 _ModuleAllpassDelayFract32 { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure INT32 maxDelay; // Maximum delay that can be realized, in samples. The size of the delay buffer (maxDelay+1)*numChannels INT32 currentDelay; // Current delay FLOAT32 coef; // Feedback/-feedforward coefficient for the allpass delay. fract32 coefFract32; // Feedback/-feedforward fractional coefficient for the allpass delay. INT32 postShift; // Number of bits to shift after the fractional multiply. This is based on gain.range. INT32 stateIndex; // Index of the oldest state variable in the array of state variables fract32* state; // State variable array } ModuleAllpassDelayFract32Class; |
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
maxDelay | int | const | 0 | 100 | 1:100000 | samples |
currentDelay | int | parameter | 0 | 0 | 0:1:100 | samples |
coef | float | parameter | 0 | 0.5 | -1:1 | |
coefFract32 | fract32 | derived | 0 | 0.5 | Unrestricted | |
postShift | int | derived | 1 | 0 | Unrestricted | |
stateIndex | int | state | 1 | 0 | Unrestricted | |
state | fract32* | 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: fract32
MATLAB Usage
File Name: allpass_delay_fract32_module.m
...