1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! # chord_detector
//!
//! A unified crate for real‐time audio analysis: compute 12‐bin chromagrams and
//! detect musical chords with minimal latency.
//!
//! ## Example
//! ```rust
//! use chord_detector::{Chromagram, ChordDetector};
//!
//! fn run() -> Result<(), Box<dyn std::error::Error>> {
//! // 1) Build a chromagram pipeline
//! let mut chroma = Chromagram::builder()
//! .frame_size(1024)
//! .sampling_rate(48_000)
//! .build()?;
//!
//! // 2) Build a chord detector
//! let mut detector = ChordDetector::builder()
//! .bleed(0.15)
//! .build();
//!
//! // 3) In your audio loop:
//! let audio_frame: Vec<f32> = vec![0.0; 1024]; // fill with actual samples
//! if let Some(chroma_bins) = chroma.next(&audio_frame)? {
//! let chord = detector.detect_chord(&chroma_bins)?;
//! println!(
//! "Detected {:?} {:?} chord with confidence {:.3}",
//! chord.root,
//! chord.quality,
//! chord.confidence
//! );
//! }
//!
//! Ok(())
//! }
//! ```
//!
//! ## Features
//! - `chromagram` (default): enables FFT‐based chromagram via `rustfft`
/// High‐level chord detector API.
pub use ;
/// Streaming chromagram extractor.
pub use ;
/// Chromagram computation module.
/// Chord detection module.