Expand description
Advanced audio analysis and forensics for OxiMedia.
This crate provides comprehensive audio analysis capabilities for professional audio applications including forensics, voice analysis, music analysis, and more.
§Features
§Spectral Analysis
- Advanced frequency-domain analysis with multiple window functions
- Spectral centroid, flatness, crest factor, and bandwidth computation
- High-resolution spectral features for detailed audio characterization
§Voice Analysis
- Voice characteristic analysis (F0, formants, jitter, shimmer, HNR)
- Gender detection using formant analysis and F0 range
- Age estimation based on voice characteristics
- Emotion detection (anger, joy, sadness, neutral)
- Speaker identification and verification
§Music Analysis
- Harmonic analysis and chord progression detection
- Advanced rhythmic analysis extending MIR capabilities
- Timbral analysis for sound quality characterization
- Instrument identification using spectral and temporal features
§Source Separation
- Vocal/instrumental separation using harmonic-percussive decomposition
- Drum track isolation
- Bass line extraction
- Multi-source separation
§Echo and Reverb Analysis
- Echo and reverb detection
- Room acoustics analysis
- RT60 reverberation time measurement
- Early reflection pattern analysis
§Distortion Analysis
- Distortion detection and quantification
- Total Harmonic Distortion (THD) measurement
- Clipping detection with threshold analysis
- Non-linear distortion characterization
§Dynamic Range Analysis
- Detailed dynamic range computation
- Crest factor analysis
- RMS level tracking over time
- Loudness variation measurement
§Transient Detection
- Transient and attack detection
- Envelope analysis with ADSR characterization
- Onset strength function computation
§Pitch Analysis
- Pitch tracking using YIN algorithm (patent-free)
- Pitch contour analysis
- Vibrato detection and measurement
- F0 estimation with confidence scoring
§Formant Analysis
- Formant frequency analysis (F1-F4)
- Formant tracking over time
- Vowel detection and classification
- Linear Predictive Coding (LPC) for formant extraction
§Audio Forensics
- Audio authenticity verification
- Edit detection (cuts, splices, insertions)
- Compression history analysis
- Background noise consistency analysis
- ENF (Electrical Network Frequency) analysis
§Noise Analysis
- Noise profiling and characterization
- Noise type classification (white, pink, environmental)
- Signal-to-noise ratio (SNR) computation
- Noise floor estimation
§Usage Example
use oximedia_audio_analysis::{
AudioAnalyzer, AnalysisConfig,
};
// Create analyzer with default configuration
let config = AnalysisConfig::default();
let analyzer = AudioAnalyzer::new(config);
// Analyze audio samples
let samples = vec![0.0_f32; 44100]; // 1 second of audio
let sample_rate = 44100.0;
let result = analyzer.analyze(&samples, sample_rate)?;
// Access spectral features
println!("Spectral centroid: {:.1} Hz", result.spectral.centroid);
println!("Spectral flatness: {:.3}", result.spectral.flatness);
// Access voice characteristics
if let Some(voice) = result.voice {
println!("F0: {:.1} Hz", voice.f0);
println!("Gender: {:?}", voice.gender);
}
§Patent-Free Implementation
All algorithms are implemented using patent-free methods:
- YIN algorithm for pitch detection
- LPC for formant analysis
- Harmonic-percussive separation for source separation
- Autocorrelation-based methods
§Real-Time Capable
Most analysis modules support frame-by-frame processing for real-time applications.
Modules§
- beat
- Beat tracking and tempo estimation for audio analysis.
- cepstral
- Cepstral analysis for audio signals.
- chroma
- Chromagram and tonal centroid (tonnetz) computation.
- compression_
analysis - Audio compression analysis: bitrate estimation, codec artefact detection, spectral hole detection, and compression history scoring.
- distortion
- Distortion analysis module.
- dynamics
- Dynamic range analysis module.
- echo
- Echo and reverb detection module.
- energy
- Signal energy analysis — RMS energy, zero-crossing rate, energy envelope, and energy-based silence detection.
- energy_
contour - Energy contour analysis for audio signals.
- forensics
- Audio forensics module for authenticity verification.
- formant
- Formant analysis module using Linear Predictive Coding (LPC).
- formant_
track - Formant frequency tracking over time.
- harmony
- Harmonic analysis: pitch classes, musical keys, chords, and key detection.
- loudness
- Short-term and integrated loudness metering (inspired by EBU R128 / ITU-R BS.1770).
- loudness_
curve - Time-varying loudness curve analysis.
- loudness_
range - Loudness range (LRA) analysis conforming to EBU R 128 / ITU-R BS.1770.
- mel_
spectrogram - Mel spectrogram computation for ML-oriented audio feature extraction. Mel spectrogram computation for ML feature extraction.
- music
- Music analysis module (extends oximedia-mir).
- noise
- Noise analysis and profiling module.
- onset
- Onset detection for audio analysis.
- pitch
- Pitch analysis module using YIN algorithm.
- pitch_
detect - Pitch detection via autocorrelation and the YIN algorithm.
- pitch_
tracker - Pitch class tracking and pitch history analysis.
- psychoacoustic
- Psychoacoustic modeling for audio analysis.
- rhythm
- Rhythm analysis: tempo estimation, beat grid, time signature detection.
- scene_
classify - Audio scene classification: Indoor, Outdoor, Quiet, Noisy, Speech, Music, Mixed. Audio scene classification using spectral features.
- separate
- Source separation module using harmonic-percussive decomposition.
- silence_
detect - Silence detection and segmentation for audio streams.
- spectral
- Spectral analysis module for frequency-domain audio analysis.
- spectral_
contrast - Spectral contrast analysis for audio characterisation.
- spectral_
features - High-level spectral feature computation: centroid, flux, rolloff.
- spectral_
flux - Spectral flux onset detection.
- stereo_
field - Stereo field analysis.
- tempo_
analysis - Tempo analysis for audio signals.
- timbre
- Timbre analysis: MFCC coefficients, spectral centroid, brightness, roughness.
- transient
- Transient detection module.
- voice
- Voice analysis module.
Structs§
- Analysis
Config - Configuration for audio analysis.
- Analysis
Result - Complete analysis result.
- Audio
Analyzer - Main audio analyzer that coordinates all analysis modules.
- Frame
Analysis - Frame-level analysis result for real-time processing.
Enums§
- Analysis
Error - Errors that can occur during audio analysis.
- Window
Type - Window function types for spectral analysis.
Functions§
- amplitude_
to_ db - Convert amplitude to decibels.
- compute_
rms - Compute RMS (Root Mean Square) level of audio samples.
- db_
to_ amplitude - Convert decibels to amplitude.
- generate_
window - Generate window function of the specified type and size.
- zero_
crossing_ rate - Compute zero-crossing rate.
Type Aliases§
- Result
- Result type for audio analysis operations.