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.
Parameters
Section titled “Parameters”number[][]
Spectrogram or time-frequency representation [freq x time]
number[]
Frequency values [freq]
harmonics
Section titled “harmonics”number[]
Harmonic numbers to consider [1, 2, 3, …]
weights?
Section titled “weights?”number[] = null
Weights for each harmonic (default: null, uniform)
aggregate?
Section titled “aggregate?”Function = null
Aggregation fn(values, weights) per bin (default: null, weighted average like np.average — NaN propagates)
filter_peaks?
Section titled “filter_peaks?”boolean = true
Keep only frequency-axis peaks of S (default: true)
fill_value?
Section titled “fill_value?”number = NaN
Value for filtered-out / out-of-bounds bins (default: NaN)
string = 'linear'
Interpolation type
number = -2
Frequency axis
Returns
Section titled “Returns”number[][]
Salience function [freq x time]