Skip to content

Library using WebAudioAPI to analyse BPM from files, audionodes. It's also able to compute BPM from streams as well as realtime using a microphone. This tool might be useful for music producers and DJs or anybody that wants to get BPM from any music source.

License

Notifications You must be signed in to change notification settings

dlepaux/realtime-bpm-analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

530 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Realtime BPM Analyzer

XO code style npm npm CI Actions Status codecov

Realtime BPM Analyzer

A powerful TypeScript library for detecting beats-per-minute (BPM) in real-time.

πŸ“š Documentation β€’ 🎯 Examples β€’ πŸš€ Getting Started


Features

  • Zero dependencies - Uses native Web Audio API
  • Real-time analysis - Analyze audio/video as it plays
  • Multiple sources - Works with files, streams, microphone, or any audio node
  • Typed events - Full TypeScript support with autocomplete
  • Client-side only - 100% privacy-focused, no data collection
  • Supports MP3, FLAC, WAV formats

Installation

npm install realtime-bpm-analyzer

Quick Example

import { createRealtimeBpmAnalyzer } from 'realtime-bpm-analyzer';

// Create analyzer
const analyzer = await createRealtimeBpmAnalyzer(audioContext);

// Connect your audio source
audioSource.connect(analyzer.node);

// Listen for BPM detection
analyzer.on('bpm', (data) => {
  console.log('BPM detected:', data.bpm[0].tempo);
});

Documentation

πŸ“– Full Documentation - Complete guides, API reference, and tutorials

Key sections:

Use Cases

  • Audio Players - Display BPM while playing tracks
  • Live Streams - Continuous BPM detection from radio/streaming
  • File Analysis - Offline BPM detection from uploaded files
  • Microphone Input - Real-time analysis from live audio
  • DJ Applications - Beat matching and tempo detection

Running Examples Locally

# Install dependencies
npm install

# Run a specific example
npm run dev --workspace=examples/01-vanilla-basic

# Available examples:
# - 01-vanilla-basic, 02-vanilla-streaming, 03-vanilla-microphone
# - 04-react-basic, 05-react-streaming, 06-react-microphone  
# - 07-vue-basic, 08-vue-streaming, 09-vue-microphone

Privacy & Security

  • 100% client-side processing
  • No data collection or transmission
  • No audio recording - real-time analysis only
  • Open source - fully auditable code

See privacy.md and security.md for details.

Contributing

Contributions are welcome! See contributing.md for guidelines.

License

Apache-2.0 License - See licence.md for details.

For commercial licensing inquiries, contact: d.lepaux@gmail.com

Credits

Inspired by Tornqvist's bpm-detective and Joe Sullivan's algorithm.

About

Library using WebAudioAPI to analyse BPM from files, audionodes. It's also able to compute BPM from streams as well as realtime using a microphone. This tool might be useful for music producers and DJs or anybody that wants to get BPM from any music source.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 7

Languages