Skip to content

signal.PitchDetectionHarm.Function.harmonicInstSum

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

dsp-collection / signal/PitchDetectionHarm / harmonicInstSum

Function: harmonicInstSum()

function harmonicInstSum(
   samples, 
   sampleRate, 
   position, 
   f0, 
   parms?): number;

Defined in: signal/PitchDetectionHarm.ts:161

Pitch salience function using a weighted sum of the harmonic amplitudes, enhanced with peak shaping based on instantaneous frequencies.

This function is similar to harmonicSum, but enhances the result by taking into account the intantaneous frequencies at the harmonic frequency positions. The accuracy of the pitch frequency estimation is improved, but at the cost of a slower execution.

Note that this is a CPU intensive pitch detection algorithm.

Parameters

samples

Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike>

The input signal.

sampleRate

number

The sample rate of the input signal. This parameter is only relevant for the parameters f0 and parms.fCutoff. To use normalized frequencies instead, a sample rate of 1 can be specified.

position

number

Position in the input signal where the pitch is to be estimated. Center position of the window. In seconds.

f0

number

The fundamental frequency (in Hz) to be evaluated.

parms?

HarmonicInstSumParms = ...

Optional secondary parameters, which have default values.

Returns

number

A measure for a pitch perception at the specified fundamental frequency. Or NaN if the pitch cannot be computed.

Clone this wiki locally