Zero dependencies
Pure ESM, nothing to install alongside it. Runs in browsers, Node, and Web Workers — no build step, no native modules, no GPU.


Pleco-Xa brings musical intelligence — BPM and beat tracking, spectral features, structural segmentation, effects, pitch tracking, and its signature loop detection — to anything that runs JavaScript. No build step, no dependencies — real-time streaming analysis and intelligent loop-point detection, running live in a browser tab.
import { beat_track, loop } from 'pleco-xa'
// Decode with Web Audio, then hand the samples to the libraryconst ctx = new AudioContext()const audio = await ctx.decodeAudioData(await (await fetch('song.mp3')).arrayBuffer())const y = audio.getChannelData(0)
// Musical timingconst { tempo, beats } = beat_track(y, audio.sampleRate)console.log(`${tempo.toFixed(1)} BPM, ${beats.length} beats`)
// The signature feature — find the best loop pointconst best = await loop.detect(audio, { strategy: 'fast' })console.log(`loop ${best.loopStart.toFixed(2)}s → ${best.loopEnd.toFixed(2)}s`)The analysis API is (Float32Array, sampleRate) everywhere, so the same code
runs in the browser, Node, and Web Workers.
Zero dependencies
Pure ESM, nothing to install alongside it. Runs in browsers, Node, and Web Workers — no build step, no native modules, no GPU.
Loop detection
The signature feature: intelligent loop-point finding with one entry point, four strategies, and a single honest confidence score.
Musical timing
Tempo and beat tracking, onset detection, and tempograms — CI-tested on synthetic click tracks, with committed golden fixtures pinning tempo and beat output.
Spectral features
STFT, mel spectrograms, MFCC, chroma, and the full family of spectral descriptors (centroid, bandwidth, rolloff, contrast, flatness).
Real-time
Worker-safe streaming analyzers and a live tempo tier — analysis that runs while the audio plays.
Pure-DSP source separation
Median-filter HPSS and REPET-SIM-style masking with no trained model, no weights, and no GPU — plus a supervised stem-guided vocal-matching pipeline. It runs in a browser tab.
feature subpath alone under 8 kB. No WASM, no model download.Ready? Install and run your first analysis → or watch every example run live on your own audio in the gallery.