Crate bpm_analyzer

Crate bpm_analyzer 

Source
Expand description

§BPM Analyzer

A real-time BPM (beats per minute) detection library that analyzes audio input using wavelet decomposition and autocorrelation techniques.

§Features

  • Real-time audio capture from system audio devices
  • Wavelet-based onset detection using Discrete Wavelet Transform (DWT)
  • Multi-band envelope analysis
  • Autocorrelation-based tempo estimation
  • Configurable BPM range and analysis parameters

§Example

use bpm_analyzer::{AnalyzerConfig, begin};

// Configure the analyzer with default settings
let config = AnalyzerConfig::builder()
    .min_bpm(60.0)
    .max_bpm(180.0)
    .build();

// Start the analyzer and receive BPM candidates
let bpm_receiver = begin(config).expect("Failed to start analyzer");

// Process BPM candidates
for peaks in bpm_receiver.iter() {
    // Each entry contains (bpm, confidence) pairs
    if let Some((bpm, confidence)) = peaks.first() {
        println!("Detected BPM: {} (confidence: {})", bpm, confidence);
    }
}

Modules§

dsp
Digital signal processing nodes for audio analysis.

Structs§

AnalyzerConfig
Configuration for the BPM analyzer.
AnalyzerConfigBuilder
Use builder syntax to set the inputs and finish with build().
Receiver
The receiving side of a channel.

Enums§

Error
Errors that can occur during BPM analysis

Functions§

autocorrelation
Computes the autocorrelation of a signal for lags [0, max_lag). Returns a Vec of length max_lag.
begin
Starts the BPM analyzer with the given configuration.

Type Aliases§

Result