nn_filter
nn_filter(
S,options?):Float64Array<ArrayBufferLike>[]
Defined in: packages/pleco-xa/src/decompose/index.js:87
Nearest-neighbor filtering (nn_filter).
Each frame (column) of S is replaced by aggregating its nearest neighbors in feature space, as selected by recurrence-matrix semantics: for output frame i the neighbor set is { j : rec[i][j] != 0 }, via a CSR-row walk in __nn_filter_helper (frames with an empty neighbor set pass through unchanged). aggregate=‘median’ with a cosine metric and a width-in-frames exclusion band is the REPET-SIM configuration (Rafii & Pardo 2012), the standard vocal-separation configuration.
The recurrence graph itself comes from segment.recurrenceMatrix (Wave-5 fixture-gated); this function adds only the neighbor-aggregation walk. NOTE: no direct fixture for the composition yet — behavior is proven against planted-repetition structure in examples/web/plot-vocal-separation.html (node-spot-run first).
Parameters
Section titled “Parameters”ArrayLike<number>[]
Feature matrix [features][frames]
options?
Section titled “options?”aggregate?
Section titled “aggregate?”string | Function
‘mean’ | ‘median’ | ‘average’ (weighted by rec values) | custom (values, weights) => number.
ArrayLike<number>[]
Precomputed recurrence matrix [frames][frames]; computed from S via recurrenceMatrix when null.
any
Remaining options (metric, width, k, sym, mode, bandwidth, self, full) forward to recurrenceMatrix.
Returns
Section titled “Returns”Float64Array<ArrayBufferLike>[]
Filtered matrix, same shape as S
Throws
Section titled “Throws”On empty input, bad rec shape, or unknown aggregate