Skip to content

signal.AdaptiveStft.Function.getHarmonicAmplitudes

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

dsp-collection / signal/AdaptiveStft / getHarmonicAmplitudes

Function: getHarmonicAmplitudes()

function getHarmonicAmplitudes(
   samples, 
   windowCenterPosition, 
   f0, 
   harmonics, 
   relWindowWidth?, 
   windowFunction?): Float64Array<ArrayBufferLike> | undefined;

Defined in: signal/AdaptiveStft.ts:135

Computes the amplitudes of the harmonic components for a specified fundamental frequency.

Parameters

samples

Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike>

The input signal.

windowCenterPosition

number

The center position of the window (in sample positions).

f0

number

The fundamental frequency. The unit of the specified frequency value is 1/samples (normalized frequency).

harmonics

number

The number of harmonics to compute.

relWindowWidth?

number = 7

An integer specifying the window width relative to the wavelength of the fundamental frequency. Optional.

windowFunction?

(x) => number

A window function. Optional.

Returns

Float64Array<ArrayBufferLike> | undefined

An array with the amplitudes of the harmonics, starting with the fundamental frequency. a[0] = amplitude of fundamental frequency, a[i] = amplitude of harmonic i+1 with the frequency f0 * (i + 1). undefined is returned if the amplitudes cannot be computed.

Clone this wiki locally