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:
- Audio Input → Audio is captured from your source
- Filtering → Optional low-pass filter to isolate bass frequencies
- Peak Detection → Identifies peaks in the audio signal at various threshold levels
- Interval Analysis → Calculates time intervals between peaks
- BPM Calculation → Converts intervals to BPM and groups similar tempos
- Result Output → Emits BPM candidates with confidence scores
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?
- 📚 Getting Started - Install and use the library
- 🎯 Core Concepts - Understand key concepts
- 💡 Examples - See practical examples