API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classBeatDetector

@codexo/exojs / audio / stable

Real-time tempo + beat tracker. Splits work between the audio-rendering thread (an AudioWorklet that runs onset detection, tempogram analysis, and parallel 3/4 and 4/4 posterior estimation) and the main thread (this class — receives beats, fires Signals, handles configuration and source routing). Accepts a wide range of BeatDetectorSources — bus, individual sound/music, raw MediaStream, or any AudioNode — and exposes a Signal for each notable event: - BeatDetector.onBeat — every detected beat - BeatDetector.onDownbeat — first beat of each bar - BeatDetector.onBarStart — bar boundary - BeatDetector.onTempoChange — when the tracked BPM changes - BeatDetector.onBeatPredicted — look-ahead schedule notice Detection is delayed by `settlingMs` (default 1500 ms) after a new source is attached; this prevents spurious beats during the algorithm's warm-up. Time-signature detection (3/4 vs 4/4) is on by default; lock to 4/4 by setting `enableTimeSignatureDetection: false`.

23
props
2
methods
5
events
Import
import { BeatDetector } from '@codexo/exojs'

Real-time tempo + beat tracker. Splits work between the audio-rendering thread (an AudioWorklet that runs onset detection, tempogram analysis, and parallel 3/4 and 4/4 posterior estimation) and the main thread (this class — receives beats, fires Signals, handles configuration and source routing).

Accepts a wide range of BeatDetectorSources — bus, individual sound/music, raw MediaStream, or any AudioNode — and exposes a Signal for each notable event: - BeatDetector.onBeat — every detected beat - BeatDetector.onDownbeat — first beat of each bar - BeatDetector.onBarStart — bar boundary - BeatDetector.onTempoChange — when the tracked BPM changes - BeatDetector.onBeatPredicted — look-ahead schedule notice

Detection is delayed by `settlingMs` (default 1500 ms) after a new source is attached; this prevents spurious beats during the algorithm's warm-up. Time-signature detection (3/4 vs 4/4) is on by default; lock to 4/4 by setting `enableTimeSignatureDetection: false`.

Constructors 1
new(options?: BeatDetectorOptions): BeatDetector
Methods 2
destroy(): void
subdivisionPhase(division: number): number
Properties 23
barPulseHalfLife: number
justBeatWindow: number
pulseHalfLife: number
bandEnergy: BandEnergy
barLength: number
barPosition: number
barPulse: number
beatPhase: number
confidence: number
gridStability: number
justBeat: boolean
lookahead: readonly UpcomingBeat[]
nextBeatTime: number
nextDownbeatTime: number
onsetStrength: number
pulse: number
ready: Promise<void>
rms: number
secondsSinceLastBeat: number
source: BeatDetectorSource
tempo: number
tempoCandidates: readonly TempoCandidate[]
timeSignature: TimeSignature
Events 5
onBarStart: Signal<[BarInfo]>
onBeat: Signal<[BeatInfo]>
onBeatPredicted: Signal<[UpcomingBeat]>
onDownbeat: Signal<[BeatInfo]>
onTempoChange: Signal<[number, number]>
Source