TableInterpFract32
Overview
Fract32 Table driven interpolation module. Supports linear and spline modes
Discussion
This module performs table lookup using defined X and Y points. 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 input to the module serves as the X value in the lookup and the output equals the Y value derived from doing the interpolation. The module is configured by setting the internal matrix .XY. The first row of .XY represents X values and the second row Y values.
At instantiation time you specify the total number of points (MAXPOINTS) in the table. MAXPOINTS determines the amount of memory allocated to the table. Then at run time, you can change the number of points actively used by the table (.numPoints). .numPoints must be less than or equal to MAXPOINTS.
The variable .order specifes either linear (=2) or cubic (=4) interpolation.
The module also provides a custom inspector for easy configuration from the Audio Weaver Designer GUI. The GUI translates the XY table into a piece wise polynomial segments. The matrix .polyCoeffs contains 4 x (MAXPOINT-1) values. Each column represents the coefficients for each polynomial. Row 1 is the X^3 coefficent, row 2 the X^2 coefficient, row 3 the X coefficient and row 4 the constant term.
If the input x falls outside of the range of values in the XY table then the input is clipped to the allowable range.
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.
Module Pack
Standard
ClassID
classID = 211
Type Definition
typedef struct _ModuleTableInterpFract32
{
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 outRange; // Indicates if coefficients are out of fractional range.
INT32 alerts; // Indicates if coefficients are out of fractional range.
INT32 order; // Order of the interpolation. This can be either 2 (for linear) or 4 (for pchip).
fract32* XY; // Lookup table. The first row is the X values and the second row is the Y values.
fract32* polyCoeffs; // Interpolation coefficients returned by the grid control.
} ModuleTableInterpFract32Class;
Variables
Properties
| Name | Type | Usage | isHidden | Default Value | Range | Units |
|---|---|---|---|---|---|---|
| maxPoints | int | const | 0 | 8 | 4:1:1000 | |
| numPoints | int | parameter | 0 | 7 | 4:1:8 | |
| outRange | int | derived | 0 | 0 | 0:1:1 | |
| alerts | int | derived | 0 | 0 | 0:1:1 | |
| order | int | parameter | 0 | 2 | 2:2:4 | |
| XY | fract32* | parameter | 0 | [2 x 8] | Unrestricted | |
| polyCoeffs | fract32* | state | 0 | [4 x 7] | 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 |
Matlab Usage
File Name: table_interp_fract32_module.m
M=table_interp_fract32_module(NAME, MAXPOINTS)
This Audio Weaver module performs interpolation using a lookup table together
with a configurable interpolation order. The table contains (X,Y) value pairs
and can be unevenly spaced.
Arguments:
NAME - name of the module.
MAXPOINTS - maximum number of points allocated to the lookup table. This
is set at design time and has a minimum value of 4. At run
time, you can change the number of values in the lookup table
from 4 to MAXPOINTS.
The module can be configured to perform linear or pchip interpolation.
Copyright (c) 2026 DSP Concepts, Inc.