Skip to content

salience

salience(S, freqs, harmonics, weights?, aggregate?, filter_peaks?, fill_value?, kind?, axis?): number[][]

Defined in: packages/pleco-xa/src/scripts/xa-harmonic.js:150

Compute the harmonic salience function

Salience measures how well the energy distribution matches a harmonic template: aggregate (default: weighted MEAN, np.average) of the energy at each bin’s harmonics, then — when filter_peaks is true — keep salience only where the ORIGINAL spectrogram has a local maximum along the FREQUENCY axis (scipy.signal.argrelmax(S, axis=-2)); all other positions get fill_value.

Tier-2 repair note (2026-07-02): the previous implementation filtered each harmonic-energy row for local maxima along the TIME axis and aggregated by weighted SUM — diverging whenever filter_peaks=true (the default). Repaired to frequency-axis peaks of S + weighted average.

number[][]

Spectrogram or time-frequency representation [freq x time]

number[]

Frequency values [freq]

number[]

Harmonic numbers to consider [1, 2, 3, …]

number[] = null

Weights for each harmonic (default: null, uniform)

Function = null

Aggregation fn(values, weights) per bin (default: null, weighted average like np.average — NaN propagates)

boolean = true

Keep only frequency-axis peaks of S (default: true)

number = NaN

Value for filtered-out / out-of-bounds bins (default: NaN)

string = 'linear'

Interpolation type

number = -2

Frequency axis

number[][]

Salience function [freq x time]