Realtime Bpm Analyzer

Design and media

Tempo (BPM) detection for the browser with the Web Audio API: files, streams, the microphone or any audio node, live as the audio plays. Also runs in Node, Bun and Deno, from a CLI and an MCP server, and in Python and Java. TypeScript, zero dependencies.

Your AI app calls the Realtime Bpm Analyzer MCP server, which does the design and media work and sends the result back to the chat.

About Realtime Bpm Analyzer

Realtime Bpm Analyzer is a community MCP server from dlepaux, filed in our directory under design and media. Tempo (BPM) detection for the browser with the Web Audio API: files, streams, the microphone or any audio node, live as the audio plays. Also runs in Node, Bun and Deno, from a CLI and an MCP server, and in Python and Java. TypeScript, zero dependencies.

Realtime Bpm Analyzer runs on your own machine: your AI app starts it with the command npx -y realtime-bpm-analyzer-cli and talks to it over standard input and output.

At a glance

Publisher
dlepaux (community)
Runs
Locally on your machine
Install from
Node.js package on npm: realtime-bpm-analyzer-cli
Written in
TypeScript
License
Apache-2.0
GitHub stars
339

How to set up Realtime Bpm Analyzer

  1. Install Node.js on the machine that runs your AI app, because Realtime Bpm Analyzer starts with npx and downloads its package on first run.
  2. Check the Realtime Bpm Analyzer README for keys or settings; the registry lists none that Realtime Bpm Analyzer requires.
  3. Add Realtime Bpm Analyzer to Claude Code, Claude Desktop, VS Code or Cursor with the config in the setup box on this page.
  4. Restart the app or reload its MCP servers, then ask it to list the Realtime Bpm Analyzer tools to confirm the connection.
  5. Run one read-only task with Realtime Bpm Analyzer first, and keep your app asking before each tool call until the results look right.

Realtime Bpm Analyzer compared with similar servers

  • Rabbithole by shlokkhemani has fewer GitHub stars than Realtime Bpm Analyzer (335 against 339); both are community servers, and both run locally.
  • Imagesorcery by sunriseapps has fewer GitHub stars than Realtime Bpm Analyzer (339 against 339); both are community servers, and both run locally.
  • Linux by rhel-lightspeed has fewer GitHub stars than Realtime Bpm Analyzer (331 against 339); both are community servers, and both run locally.

Before you connect Realtime Bpm Analyzer

  • Give Realtime Bpm Analyzer its own API key or account with the smallest permissions the job needs, never an admin key.
  • Keep your AI app asking before each Realtime Bpm Analyzer tool call until you trust what it does with them.
  • Treat text that Realtime Bpm Analyzer fetches as data. Pages, files and messages can hold instructions written to steer an AI.
  • Read the open issues for Realtime Bpm Analyzer on GitHub to see what breaks and how fast the maintainers reply.

Marketing use cases for Realtime Bpm Analyzer

How marketing and sales teams put Realtime Bpm Analyzer to work, by company size. Pick the size closest to yours and start Realtime Bpm Analyzer on one use case.

Small business

  • A small business can use Realtime Bpm Analyzer to resize and adapt one design for every channel instead of hiring for each version.
  • Owners can ask Realtime Bpm Analyzer to pull brand assets and make quick ad and social variations that still look on brand.
  • Realtime Bpm Analyzer runs on your own computer, which keeps data local; it needs a little setup, so a small team should plan an hour for it.

Mid-market

  • Creative teams can connect Realtime Bpm Analyzer so agents produce variants for testing while designers keep control of the master files.
  • Marketing teams can use Realtime Bpm Analyzer to hand off designs to web and ads with specs attached, cutting review rounds.
  • Start Realtime Bpm Analyzer on one workflow with one owner, measure the time it saves, then roll it out to the wider team.

Enterprise

  • Enterprises can use Realtime Bpm Analyzer with brand rules and approved assets only, so generated work stays inside the brand system.
  • Large creative ops teams can use Realtime Bpm Analyzer to localize and version assets for many markets with review built in.
  • Realtime Bpm Analyzer is a community server, so have security review the code and pin a version before Realtime Bpm Analyzer touches company data.

Need help becoming an AI-forward company?

We connect MCP servers and AI agents to your CRM, content and data, with the guardrails your team needs.

Contact us

Realtime Bpm Analyzer README

From dlepaux/realtime-bpm-analyzer on GitHub, shared under its Apache-2.0 license. Images are left out; the original has them.

README.md

Realtime BPM Analyzer

Detects the tempo (BPM) of music in the browser, live as it plays or from a whole file, and in Node.js, Python, Java, Kotlin, C# and Swift.

📚 Documentation • 🎯 Examples • 🚀 Getting Started

Platforms

Platform Package Install Guide
Browser, live or from a file realtime-bpm-analyzer npm install realtime-bpm-analyzer Getting started
Node.js, Deno and Bun realtime-bpm-analyzer/node npm install realtime-bpm-analyzer Node.js
Python 3.11+ realtime-bpm-analyzer pip install realtime-bpm-analyzer Python
Java 8+, Kotlin and Android io.github.dlepaux:realtime-bpm-analyzer implementation("io.github.dlepaux:realtime-bpm-analyzer:6.3.0") Java and Kotlin
C# on .NET Standard 2.0: Unity, Godot and .NET RealtimeBpmAnalyzer dotnet add package RealtimeBpmAnalyzer C#, Unity and Godot
Swift 5.9+: iOS, macOS and Linux realtime-bpm-analyzer-swift Swift Package Manager, from https://github.com/dlepaux/realtime-bpm-analyzer-swift Swift

The Python, Java, C# and Swift ports run the offline analysis on samples you decode. They give the same readings as the JS library, proven by shared conformance vectors. Live input from a microphone or a stream is the browser's.

Features

  • Zero dependencies - Uses native Web Audio API
  • Real-time analysis - Analyze audio/video as it plays
  • Two engines, one reading - The tempogram by default, engine: 'peaks' for the 5.x engine
  • Multiple sources - Works with files, streams, microphone, or any audio/video node
  • Typed events - Full TypeScript support with autocomplete
  • Runs locally - The library analyzes audio on the device, makes no network call of its own and collects nothing
  • Any decoded audio - The library reads decoded audio: in the browser, whatever decodeAudioData supports; in Node.js, samples you decode. The CLI reads MP3, WAV, FLAC, OGG and Opus files, and other formats through ffmpeg

Installation

npm install realtime-bpm-analyzer

Quick Example

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

// In a click handler: browsers start audio only after a user gesture
const audioContext = new AudioContext();
const analyzer = await createRealtimeBpmAnalyzer(audioContext);

// An <audio> element as the source. Connect it to the analyzer's input, which feeds the engine you picked,
// and to the speakers: a media element source plays only through the nodes it is connected to
const audioElement = document.querySelector('audio')!;
const source = audioContext.createMediaElementSource(audioElement);
source.connect(analyzer.input);
source.connect(audioContext.destination);

// A reading on each analysis step outside listening: twice a second with the default
// tempogram engine, about ten times a second with peaks
analyzer.on('reading', (reading) => {
  console.log('BPM:', reading.bpm, 'state:', analyzer.state.status);
});

// The state moves through listening, settling, locked and stopped
analyzer.on('statechange', ({ to }) => {
  if (to.status === 'locked') {
    console.log('Locked on', to.reading.bpm);
  }
});

While locked, keep showing the latest reading: the tempo can still move without a statechange.

A whole file
import { analyzeFullBuffer } from 'realtime-bpm-analyzer';

// A File from an <input type="file">, or a Blob from fetch(). Call it from a user gesture, such as the input's
// change event, so the AudioContext starts without an autoplay warning
async function bpmOf(file: Blob) {
  const audioContext = new AudioContext();
  const audioBuffer = await audioContext.decodeAudioData(await file.arrayBuffer());
  await audioContext.close(); // the decoded buffer outlives its context
  // The same reading as realtime, or null when no tempo was found
  const reading = await analyzeFullBuffer(audioBuffer);
  return reading?.bpm ?? null;
}
How it works, and its limits

The default engine, the tempogram, measures how the sound changes from moment to moment across several frequency bands, and reads the tempo as the spacing that repeats most in those changes. engine: 'peaks', the 5.x engine, low-passes the audio and counts the intervals between its loudest peaks. Both report the same reading, with a confidence that is the chance the reading is right, calibrated on a labelled benchmark from 90 to 180 BPM. Outside that range, or on a custom tempoRange, the confidence is null: unmeasured.

Every tempo is reported in a range, 90 to 180 BPM by default. A track outside it reads at double or half its tempo: 70 BPM reads 140, and a track at about 180 BPM or faster can read at half. The candidates mark the half and double readings, and tempoRange moves the range. Music without a steady beat is the hard case: expect a lower confidence, a wrong reading or none. The benchmark describes the data, the method and what was measured.

Strict CSP and browser extensions

The worklet loads from a blob: URL by default. Pages whose Content Security Policy blocks blob: scripts, and Manifest V3 extensions, serve the published processor file (realtime-bpm-analyzer/processor, i.e. dist/realtime-bpm-processor.js) from their own origin and pass its URL:

const analyzer = await createRealtimeBpmAnalyzer(audioContext, {
  processorUrl: chrome.runtime.getURL('realtime-bpm-processor.js'), // or '/realtime-bpm-processor.js'
});

See the strict CSP guide for Vite and extension setups.

Node.js

realtime-bpm-analyzer/node analyzes decoded PCM samples without Web Audio, in Node.js, Bun or Deno, with no added dependency. It returns the same reading as analyzeFullBuffer for the same samples, or null when it finds no tempo. Decoding is up to you (a WAV reader, ffmpeg, ...):

import {analyzeChannelData} from 'realtime-bpm-analyzer/node';

const reading = await analyzeChannelData(channelData, 44100); // Float32Array of one channel
console.log(reading?.bpm, reading?.candidates);

See the Node.js guide.

Command line

A separate package, realtime-bpm-analyzer-cli, detects the BPM of audio files from a terminal, so this library stays dependency-free:

npx realtime-bpm-analyzer-cli song.mp3        # 128 BPM, the engine, its confidence and the top candidates
npx realtime-bpm-analyzer-cli --json ./music  # every audio file of a folder, as JSON

See the command-line guide.

AI assistants (MCP)

realtime-bpm-analyzer-mcp is a local MCP server, so Claude Desktop, Claude Code or any MCP client can detect the BPM of files on your disk. It runs on your machine over stdio: the audio never leaves it.

claude mcp add bpm -- npx -y realtime-bpm-analyzer-mcp   # Claude Code

See the MCP guide for Claude Desktop and the two tools, analyze_file and analyze_folder.

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 - Whole-file BPM detection from local files
  • Microphone Input - Real-time analysis from live audio
  • DJ Applications - Beat matching and tempo detection

Running Examples Locally

From a clean clone, at the repository root:

# Install the workspace from the lockfile
npm ci

# Build the library: the examples import it from its dist/ folder
npm run build -w realtime-bpm-analyzer

# Run one example
npm run dev -w examples/01-vanilla-basic

Each folder in examples/ is one app, in vanilla JavaScript, React or Vue. examples/readme.md gives each example's port, npm run examples:dev to start all nine at once, and why the microphone examples need localhost or HTTPS.

Privacy & Security

These points cover the library, the CLI and the MCP server:

  • Local processing - audio is analyzed on the device and never leaves it
  • No data collection or transmission - no network call of their own, no telemetry
  • No audio recording - audio is analyzed, not kept
  • Open source - fully auditable code

The website that presents them, realtime-bpm-analyzer.com, is a separate thing. Its tools analyze your audio in your browser, and the website measures its own pages with Google Analytics, as Website Privacy describes.

See privacy.md and security.md for details.

Live BPM Detector for Chrome and Edge

Want the tempo without writing code? Live BPM Detector is a free extension for Chrome and Edge, built on this library. It shows the live tempo of the music playing in the current tab, on YouTube, SoundCloud, Bandcamp and more. Your audio never leaves your device. This extension is independent, and is not affiliated with or endorsed by any of these services.

Contributing

Contributions are welcome! See contributing.md for guidelines.

License

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

Sponsors

If your product depends on this library, consider sponsoring its maintenance via GitHub Sponsors.

Credits

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

Questions about Realtime Bpm Analyzer

What is the Realtime Bpm Analyzer MCP server?

Tempo (BPM) detection for the browser with the Web Audio API: files, streams, the microphone or any audio node, live as the audio plays. Also runs in Node, Bun and Deno, from a CLI and an MCP server, and in Python and Java. TypeScript, zero dependencies. Realtime Bpm Analyzer is maintained by dlepaux on GitHub at dlepaux/realtime-bpm-analyzer, and works with AI apps that support the Model Context Protocol, such as Claude, Cursor and VS Code.

How do I install the Realtime Bpm Analyzer MCP server?

Add Realtime Bpm Analyzer to your AI app's MCP config with the command npx -y realtime-bpm-analyzer-cli. In Claude Code, run claude mcp add --transport stdio realtime-bpm-analyzer -- npx -y realtime-bpm-analyzer-cli. To run Realtime Bpm Analyzer this way you need Node.js installed.

Does Realtime Bpm Analyzer need an API key?

The registry lists no required keys for Realtime Bpm Analyzer. Check the Realtime Bpm Analyzer README for optional settings, and expect a remote server to ask you to sign in the first time you connect.

Is Realtime Bpm Analyzer an official MCP server?

No. Realtime Bpm Analyzer is a community server maintained by dlepaux. Community servers can be excellent; read the code and the open issues before you give Realtime Bpm Analyzer access to company data.

What license is Realtime Bpm Analyzer under?

Realtime Bpm Analyzer is released under the Apache-2.0 license, according to its GitHub repository. The license covers the code of Realtime Bpm Analyzer; the service it connects to has its own terms.