Skip to content

What is Realtime BPM Analyzer? โ€‹

Realtime BPM Analyzer is a powerful, dependency-free TypeScript/JavaScript library that enables you to detect the beats-per-minute (BPM) or tempo of audio and video sources directly in the browser.

Key Features โ€‹

๐ŸŽต Real-Time Analysis โ€‹

Analyze BPM while audio or video is playing. Get instant feedback with both continuous updates and stable BPM detection events.

โšก Zero Dependencies โ€‹

Built entirely on the Web Audio API with no external dependencies. This keeps the library lightweight (< 5KB gzipped) and ensures compatibility across modern browsers.

๐ŸŽฏ Accurate Detection โ€‹

Uses an advanced algorithm based on:

  • Amplitude threshold scanning - Detects peaks in the audio signal
  • Interval analysis - Identifies patterns in peak timing
  • Tempo grouping - Groups similar tempos and selects the best candidates

๐ŸŽฌ Multiple Input Sources โ€‹

Works with various audio sources:

  • HTML <audio> and <video> elements
  • File uploads (MP3, FLAC, WAV)
  • Microphone/getUserMedia streams
  • Network audio streams
  • Any source compatible with Web Audio API

๐Ÿ“ฆ TypeScript Support โ€‹

Written in TypeScript with complete type definitions for excellent IDE integration and type safety.

How It Works โ€‹

The library analyzes audio data in real-time using the Web Audio API's AudioWorkletProcessor. Here's a simplified flow:

  1. Audio Input โ†’ Audio is captured from your source
  2. Filtering โ†’ Optional low-pass filter to isolate bass frequencies
  3. Peak Detection โ†’ Identifies peaks in the audio signal at various threshold levels
  4. Interval Analysis โ†’ Calculates time intervals between peaks
  5. BPM Calculation โ†’ Converts intervals to BPM and groups similar tempos
  6. Result Output โ†’ Emits BPM candidates with vote counts and a confidence share

Use Cases โ€‹

Perfect for:

  • ๐ŸŽง DJ Applications - Auto-sync tracks, beatmatching
  • ๐ŸŽต Music Players - Display current track tempo
  • ๐Ÿ“Š Audio Visualization - Sync visuals to detected BPM
  • ๐Ÿ’ช Fitness Apps - Match workout intensity to music tempo
  • ๐ŸŽน Music Production Tools - Analyze and catalog track tempos
  • ๐ŸŽช Interactive Experiences - Create tempo-reactive installations

Browser Support โ€‹

Works in all modern browsers that support:

  • โœ… Web Audio API
  • โœ… AudioWorklet

TIP

For older browser support, consider using a polyfill or fallback strategy.

Next Steps โ€‹

Ready to get started?