API reference

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

C

classBeatDetector

@codexo/exojs-audio-fx / 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 — 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`.

23
props
2
methods
5
events
Import
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`.

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