Array node
Array Interpolate
Resample an array to a target length using linear or nearest-neighbor interpolation. Stretches or compresses the array data to fit exactly the specified number of output elements.
Inputs
| Port | Type | Default |
|---|---|---|
| ArrayThe list to resample. Numeric elements are blended; anything non-numeric is picked by nearest instead. | any | — |
| Target LengthHow many elements come out. Values below 1 are treated as 1; matching the source length passes the list through untouched. | int | 100 |
| ModeLinear blends between neighbouring elements for a smooth resample, Nearest snaps to the closest one and keeps hard steps. Values outside the list fall back to Linear. | int | 0 |
Outputs
| Port | Type |
|---|---|
| Result | any |
| Count | int |
How It Works
Array Interpolate resamples the input array to exactly Target Length elements:
- 0 — Linear: Smoothly interpolates between neighboring values. Best for continuous signals where smooth transitions matter.
- 1 — Nearest: Each output element takes the value of the nearest input element. Best for discrete data where interpolation would create invalid intermediate values.
If Target Length is larger than the input, the array is upsampled (stretched). If smaller, it's downsampled (compressed).
Use Cases
- Display normalization: Resize any data array to match the pixel width of a display or plot.
- Sample rate conversion: Convert between different sample rates by resampling to the target length.
- Time stretching: Stretch or compress a recorded sequence to a new duration.
- Array alignment: Make two arrays the same length for element-wise comparison or operations.
Tips
- Linear mode produces smoother results but may introduce values that didn't exist in the original data.
- Nearest mode preserves original values exactly — use it for categorical or integer data.
- Target Length of 0 or negative returns an empty array.
Open Array Interpolate in the interactive catalog →
Array Interpolate is one of 381 nodes in Grafit Pro.
Free download. Every feature for 7 days, no card. Then €99.99 once — or keep playing your projects as a Player.