Skip to content
Pleco-Xa — a waveform tied into a loopPleco-Xa — a waveform tied into a loop

Pleco-Xa

Musical timing, spectral features, and intelligent loop detection — in the browser, with zero dependencies.

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 library
const ctx = new AudioContext()
const audio = await ctx.decodeAudioData(await (await fetch('song.mp3')).arrayBuffer())
const y = audio.getChannelData(0)
// Musical timing
const { tempo, beats } = beat_track(y, audio.sampleRate)
console.log(`${tempo.toFixed(1)} BPM, ${beats.length} beats`)
// The signature feature — find the best loop point
const 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.

  • ~89 kB min+gzip for the entire engine — the feature subpath alone under 8 kB. No WASM, no model download.
  • TypeScript declarations for the barrel and all 19 subpaths — autocomplete works out of the box.
  • 26 CI-gated test suites (237 tests) — loop points locked against committed golden fixtures on real audio, within ±10 ms.
  • Explicit tiers, never silent. Quality is the default; fast/live variants are separate named calls, and anything that can’t produce a valid result throws with diagnostics rather than fabricating a number.

Ready? Install and run your first analysis → or watch every example run live on your own audio in the gallery.