Skip to main content

Crate oximedia_audio_analysis

Crate oximedia_audio_analysis 

Source
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§

AnalysisConfig
Configuration for audio analysis.
AnalysisResult
Complete analysis result.
AudioAnalyzer
Main audio analyzer that coordinates all analysis modules.
FrameAnalysis
Frame-level analysis result for real-time processing.

Enums§

AnalysisError
Errors that can occur during audio analysis.
WindowType
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.