bpm-finder-tools
bpm-finder-tools is a lightweight Rust utility package for audio-file BPM analysis, tap tempo analysis, BPM conversion, and practical tempo normalization. It is maintained by BPM Finder, the browser-based tool for fast and privacy-first BPM workflows.
Why this crate exists
Many music and workflow tools only need a few reliable tempo primitives:
- Detect BPM from supported audio files
- Estimate BPM from tap intervals
- Convert BPM into milliseconds per beat or bar
- Normalize half-time and double-time readings into a practical range
This crate keeps those utilities small, dependency-light, and easy to embed in Rust applications or command-line workflows.
Supported file decoding currently includes WAV, MP3, FLAC, OGG/Vorbis, and common MP4/M4A AAC or ALAC audio files.
Installation
Add the crate to your project:
[]
= "0.1.0"
Or install the CLI from source:
Library usage
Tap tempo
use tap;
let analysis = analyze_intervals?;
assert_eq!;
assert_eq!;
assert_eq!;
# Ok::
Analyze an audio file
use file;
let analysis = analyze_path?;
println!;
println!;
# Ok::
BPM and milliseconds conversion
use convert;
let beat_ms = bpm_to_ms_per_beat?;
let bar_ms = bpm_to_ms_per_bar?;
let bpm = ms_per_bar_to_bpm?;
assert_eq!;
assert_eq!;
assert_eq!;
# Ok::
Normalize into a practical range
use range;
assert_eq!;
assert_eq!;
assert_eq!;
assert!;
# Ok::
CLI usage
Example output:
$ bpm-finder-tools file ./loop.wav
File: ./loop.wav
Detected BPM: 120
Rounded BPM: 120
Normalized BPM: 120
Confidence: 0.742
Duration: 8
Sample rate: 44100 Hz
$ bpm-finder-tools tap 500 480 495 505
Tap intervals: 500, 480, 495, 505
Average interval: 495 ms
Exact BPM: 121.212
Rounded BPM: 121
Public API
TapTempoAnalysis
average_interval_ms: f64bpm: f64rounded_bpm: u32
AudioFileAnalysis
bpm: f64rounded_bpm: u32normalized_bpm: f64confidence: f64duration_seconds: f64analyzed_seconds: f64sample_rate: u32
file
analyze_path(path, min_bpm, max_bpm) -> Result<AudioFileAnalysis, TapTempoError>analyze_samples(samples, sample_rate, min_bpm, max_bpm) -> Result<AudioFileAnalysis, TapTempoError>
tap
analyze_intervals(intervals_ms: &[f64]) -> Result<TapTempoAnalysis, TapTempoError>bpm_from_intervals(intervals_ms: &[f64]) -> Result<f64, TapTempoError>
convert
bpm_to_ms_per_beat(bpm: f64) -> Result<f64, TapTempoError>bpm_to_ms_per_bar(bpm: f64, beats_per_bar: u32) -> Result<f64, TapTempoError>ms_per_beat_to_bpm(milliseconds: f64) -> Result<f64, TapTempoError>ms_per_bar_to_bpm(milliseconds: f64, beats_per_bar: u32) -> Result<f64, TapTempoError>
range
normalize(bpm: f64, min: f64, max: f64) -> Result<f64, TapTempoError>is_within(bpm: f64, min: f64, max: f64) -> Result<bool, TapTempoError>half_time(bpm: f64) -> Result<f64, TapTempoError>double_time(bpm: f64) -> Result<f64, TapTempoError>
Development
Release notes
Current version: 0.1.0
- First public release
- Library API plus CLI
- Basic audio-file BPM analysis for supported formats
License
MIT