Skip to content

API Reference


API Reference / BpmAnalyzerEventMap

Type Alias: BpmAnalyzerEventMap

ts
type BpmAnalyzerEventMap = {
  bpm: BpmCandidates;
  bpmStable: BpmCandidates;
  analyzerReset: void;
  analyzeChunk: Float32Array;
  validPeak: {
     threshold: Threshold;
     index: number;
  };
  error: {
     message: string;
     error: Error;
  };
};

Defined in: core/types.ts:31

Type-safe event listener map for BPM analyzer events

Properties

PropertyTypeDescriptionDefined in
bpmBpmCandidatesEmitted continuously during BPM analysis with current tempo candidatescore/types.ts:33
bpmStableBpmCandidatesEmitted when BPM detection has stabilized with high confidencecore/types.ts:35
analyzerResetvoidEmitted when the analyzer state has been resetcore/types.ts:37
analyzeChunkFloat32ArrayEmitted in debug mode when analyzing audio chunkscore/types.ts:39
validPeak{ threshold: Threshold; index: number; }Emitted in debug mode when a valid peak is detectedcore/types.ts:41
validPeak.thresholdThreshold-core/types.ts:41
validPeak.indexnumber-core/types.ts:41
error{ message: string; error: Error; }Emitted when an error occurs during processing. Remarks Worklet-load failures thrown by createRealtimeBpmAnalyzer wrap the underlying cause via Error.cause (ES2022). Inspect error.cause to read the originating DOMException. Example analyzer.on('error', ({error}) => { console.log(error.message); console.log((error as Error).cause); });core/types.ts:56
error.messagestring-core/types.ts:56
error.errorError-core/types.ts:56

Released under the Apache License 2.0