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 — a bus, an individual Voice, a 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 Early beats arrive with low latency tagged `status: 'provisional'` (after a short `minSettlingMs` warm-up, default 400 ms) for snappy visual reactivity, then promote to `status: 'locked'` once the tempo grid is trustworthy — a single BeatDetector.onBeat signal carries both via BeatInfo.status. Set `emitProvisionalBeats: false` to receive only locked beats. 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-audio-fx' 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 — a bus, an individual Voice, a 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
Early beats arrive with low latency tagged `status: 'provisional'` (after a short `minSettlingMs` warm-up, default 400 ms) for snappy visual reactivity, then promote to `status: 'locked'` once the tempo grid is trustworthy — a single BeatDetector.onBeat signal carries both via BeatInfo.status. Set `emitProvisionalBeats: false` to receive only locked beats. 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]>