markitdown
Convert various file formats (PDF, Word, Excel, images, audio) to Markdown.
MImicrosoft/markitdown199k近 7 天新增 1,075 个 star
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.
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
| 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.
engine: 'peaks' for the 5.x enginedecodeAudioData supports; in Node.js, samples you decode. The CLI reads MP3, WAV, FLAC, OGG and Opus files, and other formats through ffmpegnpm install realtime-bpm-analyzer
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.
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;
}
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.
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.
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.
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.
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.
📖 Full Documentation - Complete guides, API reference, and tutorials
Key sections:
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.
These points cover the library, the CLI and the MCP server:
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.
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.
Contributions are welcome! See contributing.md for guidelines.
Apache-2.0 License - See license.md for details.
If your product depends on this library, consider sponsoring its maintenance via GitHub Sponsors.
Inspired by Tornqvist's bpm-detective and Joe Sullivan's algorithm.
Convert various file formats (PDF, Word, Excel, images, audio) to Markdown.
MImicrosoft/markitdown199k近 7 天新增 1,075 个 star
Official HyperFrames by HeyGen: the best AI video editor in chat. Captions, motion graphics, MP4.
HEheygen-com/hyperframes93k近 7 天新增 4,463 个 star
draw.io diagrams your AI agent draws on a live browser canvas that you can also edit by hand
DADayuanJiang/next-ai-draw-io37k近 7 天新增 119 个 star
Search your local screen recordings, audio transcripts, and computer activity from screenpipe.
SCscreenpipe/screenpipe23k近 7 天新增 97 个 star