API reference
Every public class, method, and event in @codexo/exojs. Generated from source.
classBeatDetector
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`.
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`.
new(options?: BeatDetectorOptions): BeatDetector destroy(): void subdivisionPhase(division: number): number 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 onBarStart: Signal<[BarInfo]> onBeat: Signal<[BeatInfo]> onBeatPredicted: Signal<[UpcomingBeat]> onDownbeat: Signal<[BeatInfo]> onTempoChange: Signal<[number, number]>