Skip to main content

resonant_analysis/
lib.rs

1#![warn(missing_docs)]
2
3//! `resonant-analysis` — high-level audio analysis features.
4//!
5//! Provides onset detection, beat tracking, pitch estimation, MFCCs,
6//! chroma features, and spectral descriptors. All algorithms build on
7//! the primitives in [`resonant-fft`] and [`resonant-core`].
8//!
9//! # Quick start
10//!
11//! ```
12//! use resonant_analysis::spectral;
13//!
14//! let magnitudes = [0.1, 0.5, 1.0, 0.3];
15//! let frequencies = [0.0, 500.0, 1000.0, 1500.0];
16//!
17//! let centroid = spectral::spectral_centroid(&magnitudes, &frequencies).unwrap();
18//! let flatness = spectral::spectral_flatness(&magnitudes).unwrap();
19//! ```
20
21/// Chroma features — 12-bin pitch class profiles.
22pub mod chroma;
23pub mod error;
24/// Key detection via Krumhansl-Schmuckler profiles.
25pub mod key;
26/// Loudness analysis: RMS, peak, and crest factor.
27pub mod loudness;
28/// LUFS measurement per ITU-R BS.1770-4.
29pub mod lufs;
30pub(crate) mod mel;
31/// Mel-frequency cepstral coefficients (MFCCs).
32pub mod mfcc;
33/// Onset detection via spectral flux and adaptive thresholding.
34pub mod onset;
35/// Pitch estimation using the YIN algorithm.
36pub mod pitch;
37/// Spectral feature extraction: centroid, spread, flatness, rolloff.
38pub mod spectral;
39/// Tempo estimation via autocorrelation of onset strength envelope.
40pub mod tempo;
41/// Time-stretching and pitch-shifting via STFT phase vocoder.
42pub mod time_stretch;
43
44pub use error::AnalysisError;
45pub use key::{KeyDetector, KeyEstimate, Mode, PitchClass};
46pub use loudness::LoudnessAnalyser;
47pub use lufs::{ChannelConfig, LufsAnalyser};