audioJS

@audio/beat-onset

Status calibrated

npm1.0.4licenseMIT

Spectral flux onset detection

Overview

Install
Updated
Family
beat, 5 packages under it
import onsets from '@audio/beat-onset'

Spectral flux. STFT → magnitude → sum positive frame-to-frame differences → adaptive threshold peak-pick. The general-purpose default.

import onsets from '@audio/beat-onset'
let ons = onsets(samples, { fs: 44100 })
Param Default
fs 44100 Sample rate
frameSize 2048 STFT window size
hopSize 512 Hop between frames
delta 1.4 Adaptive threshold multiplier
windowSize 8 Peak-pick local mean window (frames)

Use when: General-purpose onset detection — music, speech, mixed material.
Ref: Dixon, "Onset Detection Revisited" (DAFx 2006).
Complexity: O(Nlog⁡F)O(N \log F) where NN = samples, FF = frame size (FFT).

Also in this package (subpath imports, each a standalone default export):

Import Function
@audio/beat-onset/energy energyOnsets(data, opts) Energy flux — no FFT, fastest, best for strong transients
@audio/beat-onset/phase phaseOnsets(data, opts) Phase deviation — robust to sustained tones
@audio/beat-onset/band bandOnsets(data, opts) Multi-band spectral flux — full-band music

See the @audio/beat umbrella docs for their param tables and refs.


Part of @audio/beat — the beat family umbrella. This README is generated from the umbrella docs.

MIT © audiojs