7 releases
| new 0.1.7 | May 21, 2026 |
|---|---|
| 0.1.6 | Apr 26, 2026 |
| 0.1.2 | Mar 17, 2026 |
#669 in Audio
Used in 8 crates
(3 directly)
5MB
104K
SLoC
oximedia-mir
Status: [Stable] | Version: 0.1.7 | Tests: 777 | Updated: 2026-05-21
Music Information Retrieval (MIR) system for OxiMedia, providing comprehensive music analysis including tempo, beat, key, chord, melody, structure, genre, mood, and spectral features.
Part of the oximedia workspace — a comprehensive pure-Rust media processing framework.
Features
- Tempo Detection — BPM detection using autocorrelation and comb filtering
- Beat Tracking — Beat and downbeat detection with dynamic programming
- Onset Detection — Transient detection using spectral flux and HFC
- Key Detection — Musical key detection (Krumhansl-Schmuckler algorithm)
- Chord Recognition — Chord progression analysis using chroma features
- Melody Extraction — Dominant melody line extraction
- Harmonic Analysis — Harmonic-percussive separation
- Structural Segmentation — Section boundary detection (intro, verse, chorus, bridge)
- Self-Similarity Analysis — Pattern and repetition detection
- Genre Classification — Genre detection from audio features
- Mood Detection — Valence and arousal estimation
- Spectral Features — Centroid, rolloff, flux, contrast
- Rhythm Features — Rhythm patterns and complexity
- Pitch Features — Pitch class profiles and chromagrams
- Audio Fingerprinting — AcoustID-compatible fingerprinting
- Chorus Detection — Repeated section detection
- Source Separation — Harmonic-percussive and vocal/instrument separation
- Cover Detection — Identifying cover versions of songs
- Fade Detection — Detecting fade-in and fade-out sections
- Vocal Detection — Distinguishing vocal vs. instrumental sections
- Playlist Generation — Automatic playlist generation based on music features
- Patent-free algorithms throughout
Usage
Add to your Cargo.toml:
[dependencies]
oximedia-mir = "0.1.7"
# Select specific features:
oximedia-mir = { version = "0.1.7", features = ["tempo", "beat", "key", "chord"] }
use oximedia_mir::{MirAnalyzer, MirConfig, FeatureSet};
let config = MirConfig::default();
let analyzer = MirAnalyzer::new(config);
let samples = vec![0.0_f32; 44100];
let result = analyzer.analyze(&samples, 44100.0)?;
if let Some(ref tempo) = result.tempo {
println!("Tempo: {:.1} BPM (confidence: {:.2})", tempo.bpm, tempo.confidence);
}
if let Some(ref key) = result.key {
println!("Key: {} (confidence: {:.2})", key.key, key.confidence);
}
Feature Flags
| Feature | Description |
|---|---|
tempo |
Tempo/BPM detection |
beat |
Beat tracking |
key |
Key detection |
chord |
Chord recognition |
melody |
Melody extraction |
structure |
Structural segmentation |
genre |
Genre classification |
mood |
Mood/sentiment analysis |
spectral |
Spectral feature extraction |
rhythm |
Rhythm analysis |
harmonic |
Harmonic analysis |
all |
All features (default) |
API Overview
Core types:
MirAnalyzer— Main analysis engineMirConfig— Analysis configurationMirError— Error type
Modules:
beat,beat_tracker— Beat and tempo analysischord,chord_recognition— Chord detectionkey,key_detection,pitch_key— Key and pitch detectionmelody— Melody extractionrhythm,rhythm_pattern— Rhythm analysisspectral,spectral_contrast,spectral_features— Spectral feature extractionaudio_features— Low-level audio featuresaudio_events— Audio event detectionchorus_detect— Chorus/repeated section detectioncover_detect— Cover song detectionfade_detect— Fade-in/fade-out detectionvocal_detect— Vocal/instrumental detectionfingerprint— Audio fingerprinting (AcoustID)genre,genre_classify— Genre classificationmood,mood_detection— Mood/valence/arousal estimationharmonic,harmonic_analysis— Harmonic analysisstructure,structure_analysis— Song structure segmentationtempo,tempo_map— Tempo estimationmelody— Melody extractionsegmentation— General audio segmentationsimilarity— Music similarity comparisonsource_separation— Source separationonset_strength— Onset detectionenergy_contour,dynamic_range— Energy and dynamicsmir_feature— Feature aggregationmusic_summary— Complete music summaryplaylist,playlist_gen— Playlist generationtuning_detect— Tuning/pitch deviation detectionloudness— Loudness analysispitch_track— Pitch tracking
License
Apache-2.0 — Copyright 2024-2026 COOLJAPAN OU (Team Kitasan)
Dependencies
~7–10MB
~188K SLoC