music_feature_analyzer library
Music Feature Analyzer Package
A comprehensive music feature analysis package that extracts detailed musical features and metadata from audio files using YAMNet AI model and signal processing.
Platform Support: This package supports Android and iOS only. Desktop (Windows, Linux, macOS) and Web platforms are not supported.
Features:
- AI-powered instrument detection
- Genre classification
- Mood analysis
- Tempo detection (BPM)
- Energy analysis
- Spectral features
- Vocal detection
- Complete metadata extraction (title, artist, album, album art, etc.)
Usage:
import 'package:music_feature_analyzer/music_feature_analyzer.dart';
// Initialize
await MusicFeatureAnalyzer.initialize();
// Extract metadata
final song = await MusicFeatureAnalyzer.metadata('/path/to/song.mp3');
print('Title: ${song.title}');
print('Artist: ${song.artist}');
print('Album: ${song.album}');
// Extract features
final features = await MusicFeatureAnalyzer.analyzeSong(song);
print('Genre: ${features.estimatedGenre}');
print('Tempo: ${features.tempoBpm} BPM');
print('Instruments: ${features.instruments}');
Classes
- Complex
- Complex number class for FFT calculations (SAME AS ORIGINAL)
- ExtractedSongFeatures
- Comprehensive song features extracted by the analyzer
- FeatureExtractor
- Main feature extractor service
- IsolateFeatureData
- Data model for passing feature extraction data to isolates This allows us to pre-load assets in the main thread and pass them to isolates
- IsolateInputData
- Input for background isolate: file path, duration, and pre-loaded model/labels. Pre-extracted audio is passed from main isolate because FFmpegKit (platform channel) cannot run inside compute isolate.
- MusicFeatureAnalyzer
- ============================================================================ MUSIC FEATURE ANALYZER - Main Package Entry Point
- Peak
- Peak data class for tempo detection (SAME AS ORIGINAL)
- SignalFeatures
- Signal processing features
- SignalProcessingResults
- Signal processing results class (same as original)
- SongModel
- Song model for the music feature analyzer package Contains all metadata information extracted from audio files
- YAMNetLabel
- YAMNet label with comprehensive categorization (SAME AS ORIGINAL)
- YAMNetResults
- YAMNet analysis results (same as original)
Extensions
- ExtractedSongFeaturesPatterns on ExtractedSongFeatures
- Adds pattern-matching-related methods to ExtractedSongFeatures.
- SongModelPatterns on SongModel
- Adds pattern-matching-related methods to SongModel.