Overview
Table driven interpolation module. Supports linear and spline modes
Discussion
This module performs table lookup using unevenly spaced X and Y values. The module supports linear and pchip interpolation. Internally the interpolation is performed using a piece wise polynomial approximation. With linear interpolation a first order polynomial is used; for pchip a 4th order polynomial is used. PChip is similar to a spline interpolation but it avoids the overshoot and undershoot that plagues splines.
...
The X values in the table have to monotonically increasing. That is, x0 < x1 < x2 < ... < xN. If this condition is not obeyed, then the module's prebuild function will generate an error.
Type Definition
Code Block |
---|
typedef struct _ModuleTableInterp { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure INT32 maxPoints; // Maximum number of values in the lookup table. The total table size is [maxPoints 2]. INT32 numPoints; // Current number of interpolation values in use. INT32 order; // Order of the interpolation. This can be either 2 (for linear) or 4 (for pchip). FLOAT32* XY; // Lookup table. The first row is the X values and the second row is the Y values. FLOAT32* polyCoeffs; // Interpolation coefficients returned by the grid control. } ModuleTableInterpClass; |
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
maxPoints | int | const | 0 | 8 | 4:1:1000 | |
numPoints | int | parameter | 0 | 4 | 4:1:8 | |
order | int | parameter | 0 | 2 | 2:2:4 | |
XY | float* | parameter | 0 | [2 x 8] | Unrestricted | |
polyCoeffs | float* | state | 0 | [4 x 7] | 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
MATLAB Usage
File Name: table_interp_module.m
...