bpm_analyzer/lib.rs
1//! # BPM Analyzer
2//!
3//! A real-time BPM (beats per minute) detection library that analyzes audio input
4//! using wavelet decomposition and autocorrelation techniques.
5//!
6//! ## Features
7//!
8//! - Real-time audio capture from system audio devices
9//! - Wavelet-based onset detection using Discrete Wavelet Transform (DWT)
10//! - Multi-band envelope analysis
11//! - Autocorrelation-based tempo estimation
12//! - Configurable BPM range and analysis parameters
13//!
14//! ## Example
15//!
16//! ```no_run
17//! use bpm_analyzer::{AnalyzerConfig, begin};
18//!
19//! // Configure the analyzer with default settings
20//! let config = AnalyzerConfig::builder()
21//! .min_bpm(60.0)
22//! .max_bpm(180.0)
23//! .build();
24//!
25//! // Start the analyzer and receive BPM candidates
26//! let bpm_receiver = begin(config).expect("Failed to start analyzer");
27//!
28//! // Process BPM candidates
29//! for detection in bpm_receiver.iter() {
30//! if let Some(bpm) = detection.bpm() {
31//! println!("Detected BPM: {:.1}", bpm);
32//! }
33//! }
34//! ```
35
36// Module declarations
37pub mod analyzer;
38pub mod config;
39pub mod device;
40pub mod dsp;
41pub mod error;
42pub mod types;
43
44// Re-exports for public API
45pub use analyzer::{begin, begin_with_device};
46pub use config::AnalyzerConfig;
47pub use crossbeam_channel::Receiver;
48pub use device::{AudioDevice, get_default_device, get_device_by_name, list_audio_devices};
49pub use error::{Error, Result};
50pub use types::{BeatTiming, BpmCandidate, BpmDetection};