Skip to content

signal.Resampling.Function.resampleLinearRef

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

dsp-collection / signal/Resampling / resampleLinearRef

Function: resampleLinearRef()

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

Defined in: signal/Resampling.ts:195

Reference implementation of one-dimensional resampling using linear interpolation.

This a slow reference implementation. It is simpler to understand than the optimized implementation and produces the same result.

Parameters

ia

ArrayLike<number>

Input array.

oa

MutableArrayLike<number>

output array.

preserveScale?

boolean = false

false: inputPosition = outputPosition / (oa.length - 1) * (ia.length - 1). The first input element matches the first output element and the last input element matches the last output element. The array is processed symetrically. true: inputPosition = outputPosition / oa.length * ia.length. The first input element matches the first output element, but the last input element does not match the last output element.

extraValues?

number = 0

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

Returns

void

Clone this wiki locally