Skip to content

signal.Resampling.Function.resampleNearestNeighbor

Christian d'Heureuse edited this page Jun 7, 2026 · 2 revisions

dsp-collection / signal/Resampling / resampleNearestNeighbor

Function: resampleNearestNeighbor()

function resampleNearestNeighbor(
   ia, 
   oa, 
   preserveScale?, 
   extraValues?): void;

Defined in: signal/Resampling.ts:58

Optimized one-dimensional resampling using nearest-neighbor interpolation.

Parameters

ia

ArrayLike<number>

Input array.

oa

MutableArrayLike<number>

output array.

preserveScale?

boolean = false

false: inputPosition = (outputPosition + 0.5) / oa.length * ia.length - 0.5. The array is processed symetrically (except for the entries which are exactly in the middle between two neighbors). true: inputPosition = outputPosition / oa.length * ia.length.

extraValues?

number = 0

Value for the extra array entries at the end, when upsampling with preserveScale = true.

Returns

void

Clone this wiki locally