AllpassDelay16Fract32
Overview
High order allpass structure with integer time delays
Discussion
The allpass_delay_module.m and allpass_delay16_module.m implement the digital system shown below:
![](../../__attachments/2807104089/image-20230125-192435.png?inst-v=afeb83b1-861e-46b8-b4de-1c642321bb7f)
The overall transfer response is an allpass filter:
![](../../__attachments/2807104089/image-20230125-192520.png?inst-v=afeb83b1-861e-46b8-b4de-1c642321bb7f)
The filter has a constant magnitude response of 1.0 and a non-zero phase response. The filter has a DC gain of 1.0.
The arguments to the module instantiation function are:
M=allpass_delay_module(NAME, MAXDELAY, OUTPUTSTATE)
MAXDELAY specifies the size of the delay buffer. At run-time, you can vary the delay in the range 0 to MAXDELAY as well as the coefficient . The third argument OUTPUTSTATE is a Boolean which specifies whether the module has an optional 2nd output pin. The 2nd output pin gets the output of the delay buffer as shown above.
The module allpass_delay16_module.m has exactly the same functionality except that the data stored in the delay line is quantized to fract16 values in order to save memory. The input data to the delay line must be in the range [-1 +1) or else it will be clipped. The output data from the delay line is converted back to floating-point values for further processing. The allpass_delay16_module.m takes roughly half the memory as compared with the allpass_delay_module.m though with a loss of precision.
Both modules operate on mono data only.
Type Definition
typedef struct _ModuleAllpassDelay16Fract32
{
 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 coef.range.
 INT32 stateIndex; // Index of the oldest state variable in the array of state variables
 INT32* state; // State variable array
} ModuleAllpassDelay16Fract32Class;
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 | int* | state | 1 | [51 x 1] | Unrestricted |
Pins
Input Pins
Name: in
Description: audio input
Data type: fract32
Channel range: Unrestricted
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: out
Description: audio output
Data type: fract32
Name: state
Description: audio output
Data type: fract32
MATLAB Usage
File Name: allpass_delay_module.m
M = allpass_delay16_fract32_module(NAME, MAXDELAY, OUTPUTSTATE)
Fract32 version of Delay based allpass (1st order), using integer length
delay. This module uses 16-bit internal state variables in order to save on
memory. Arguments:
NAME - name of the module.
MAXDELAY - Maximum delay, in samples.
OUTPUTSTATE - optional Boolean argument that specifies whether
the module has a second output pin which gets the
direct output of the state buffer. By default,
OUTPUTSTATE = 0.