FIRInterpolator
Overview
Interpolator combining an upsampler and an FIR filter
Discussion
The FIR interpolator module implements an upsampler (zero stuffer) followed by an FIR filter. An efficient polyphase algorithm is used which reduces the processing load. The module operates on multiple channels with all channels sharing the same set of filter coefficients. The filter coefficients are stored in the array, coeffs, in normal order. Each channel uses a circular buffer of length N/L, where N is the filter length and L is the interpolation factor.
The output block size equals the input block size multiplied by L. The output sample rate equals the input sample rate multiplied by L.
The latency through the module in samples is displayed in the Audio Weaver Designer GUI. The underlying FIR processing occurs at the output sampling rate and the latency is the delay in samples at the higher sampling rate.
Type Definition
typedef struct _ModuleFIRInterpolator
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
INT32 L; // Upsampling factor.
INT32 N; // Length of the filter.
INT32 polyphaseLen; // Length of each polyphase filter component.
INT32 stateIndex; // Index of the oldest state variable in the array of state variables.
INT32 stateLen; // Length of the circular state buffer.
FLOAT32* coeffs; // Filter coefficient array in normal order.
FLOAT32* state; // State variable array. The size of the array equals stateLen*numChannels.
void * hardware_specific_struct_pointer; // Usually NULL, but for optimizations that use 3rd party optimizations (like ne10), this may point to the required instance structure
} ModuleFIRInterpolatorClass;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
L | int | const | 0 | 2 | 2:1:512 | Â |
N | int | const | 0 | 32 | 1:1:5000 | samples |
polyphaseLen | int | const | 1 | 16 | Unrestricted | Â |
stateIndex | int | state | 1 | 0 | Unrestricted | Â |
stateLen | int | const | 1 | 16 | Unrestricted | Â |
coeffs | float* | parameter | 0 | [32 x 1] | Unrestricted | Â |
state | float* | state | 1 | [16 x 1] | Unrestricted | Â |
hardware_specific_struct_pointer | void * | state | 1 | Â | Unrestricted | Â |
Pins
Input Pins
Name: in
Description: audio input
Data type: float
Channel range: Unrestricted
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: out
Description: audio output
Data type: float
MATLAB Usage
File Name: fir_interpolator_module.m
M=fir_interpolator_module(NAME, L, N)
Implements an interpolator module which combines an upsampler and
an FIR filter. An efficient polyphase algorithm is used to
reduce the required computation. The module has a multichannel
input pin and a multichannel output pin.
Arguments:
NAME - name of the module.
L - interpolator factor.
N - length of the filter (number of taps).
Note that due to the way the polyphase filter is implemented, N
must be a multiple of L. This is checked by the instantiation
function.
Â