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 detection in bpm_receiver.iter() {
    if let Some(bpm) = detection.bpm() {
        println!("Detected BPM: {:.1}", bpm);
    }
}

Re-exports§

pub use analyzer::begin;
pub use analyzer::begin_with_device;
pub use config::AnalyzerConfig;
pub use device::AudioDevice;
pub use device::get_default_device;
pub use device::get_device_by_name;
pub use device::list_audio_devices;
pub use error::Error;
pub use error::Result;
pub use types::BeatTiming;
pub use types::BpmCandidate;
pub use types::BpmDetection;

Modules§

analyzer
Core BPM analysis functionality.
config
Configuration types for the BPM analyzer.
device
Audio device discovery and selection.
dsp
error
Error types for the BPM analyzer.
types
Core types for BPM detection results.

Structs§

Receiver
The receiving side of a channel.