laplacianSegmentation
laplacianSegmentation(
features,options?):object
Defined in: packages/pleco-xa/src/segment/laplacian-segmentation.js:175
Structural segmentation of a beat/frame-synchronous feature matrix by Laplacian spectral clustering (McFee & Ellis, 2014).
Two input forms:
-
Single feature stack —
laplacianSegmentation(features2d, opts): the same d×n matrix drives BOTH the recurrence graph and the path graph. Convenient when one representation must serve both roles. -
Two-feature form —
laplacianSegmentation({ recurrenceFeatures, pathFeatures }, opts): the recurrence affinity Rf is built fromrecurrenceFeaturesand the sequential path graph R_path frompathFeatures— one feature for repetition (typically a beat-synced CQT or chroma) and another for local continuity (typically MFCC). Both matrices must share the same number of frames (columns); their feature-row counts may differ.
Parameters
Section titled “Parameters”features
Section titled “features”Float32Array<ArrayBufferLike>[] | Float64Array<ArrayBufferLike>[] | number[][] | { pathFeatures: number[][]; recurrenceFeatures: number[][]; }
A single d×n feature matrix (rows = features, columns = frames), or an
object carrying separate recurrenceFeatures and pathFeatures matrices.
options?
Section titled “options?”number = 5
Number of segments / spectral components.
number = 0.5
Balance between recurrence (Rf) and path
(R_path) graphs: A = μ·Rf + (1 − μ)·R_path, μ ∈ [0, 1].
width?
Section titled “width?”number = 3
Recurrence-matrix width band (links with |i − j| < width are suppressed; prevents same-bar self-links).
Returns
Section titled “Returns”object
segmentIds[i] is the cluster label of frame i; boundaries is the
ascending list of internal segment-onset frames
(1 + where(segmentIds[:-1] ≠ segmentIds[1:])).
boundaries
Section titled “boundaries”boundaries:
number[]
segmentIds
Section titled “segmentIds”segmentIds:
Int32Array