A sophisticated web application that uses machine learning to classify music genres from audio files with 73% accuracy. Features comprehensive audio analysis, real-time visualizations, and multiple music processing tools.
- Genre Classification: ML model with 73% accuracy across 10 genres
- Real Audio Analysis: MFCC, spectral, and temporal feature extraction
- Confidence Scoring: Detailed probability breakdowns with uncertainty detection
- Real-time Audio Visualizations: Waveform, spectrum, MFCC, and time-domain graphs
- Interactive Audio Player: Vinyl-style player with equalizer
- Feature Extraction: Tempo, key, energy, spectral centroid, and more
- Batch Processing: Upload and analyze multiple files simultaneously
- Audio Mashup Mixer: Blend two tracks with adjustable parameters
- Music Visualizer: Real-time animated visualizations
- Audio Comparison: Side-by-side track analysis with similarity scoring
- Multiple Formats: JSON, CSV, PDF, and text reports
- Batch Export: Comprehensive results for multiple files
- Shareable Results: Clipboard copy and social sharing
- Blues πΈ
- Classical π»
- Country π€
- Disco π
- Hiphop π€
- Jazz π·
- Metal π€
- Pop π€
- Reggae π΄
- Rock πΈ
- Python 3.8+
- Modern web browser with Web Audio API support
- Clone the repository
git clone https://github.com/yourusername/music-genre-classifier.git cd music-genre-classifier - Install Python dependencies
pip install -r requirements.txt
- Train the model (optional - pre-trained model included)
python train_model_v2.py
- Start the Flask server
python app.py
- Open your browser
http://localhost:5000
- Flask: Web framework and API
- Scikit-learn: Machine learning (Random Forest + Gradient Boosting ensemble)
- Librosa: Audio feature extraction
- NumPy/SciPy: Scientific computing
- Vanilla JavaScript: Modern ES6+ features
- Web Audio API: Real-time audio processing
- Canvas API: Dynamic visualizations
- Tailwind CSS: Responsive styling
- MFCC Analysis: 13 coefficients with statistical features
- Spectral Features: Centroid, rolloff, bandwidth, contrast
- Temporal Features: Tempo, zero-crossing rate, RMS energy
- Harmonic/Percussive: Source separation analysis
music-genre-classifier/ βββ app.py # Flask backend server βββ train_model.py # Original model training βββ train_model_v2.py # Improved ensemble model βββ debug_model.py # Model debugging and testing βββ models/ # Trained model files βββ static/ β βββ script.js # Main application logic β βββ real-audio-visualizer.js # Audio visualization β βββ batch-processor.js # Batch upload system β βββ export-manager.js # Export functionality β βββ keyboard-shortcuts.js # UX enhancements βββ templates/ β βββ index.html # Main interface βββ requirements.txt # Python dependencies
- Drag & drop an audio file (MP3/WAV, up to 50MB)
- View real-time analysis with interactive visualizations
- Explore genre prediction with confidence scores
- Export results in multiple formats
- Upload multiple audio files
- Monitor progress with live updates
- View aggregated statistics and genre distribution
- Export comprehensive batch reports
- Mashup Mixer: Combine two tracks with volume control and crossfade
- Music Visualizer: Real-time animated spectrum displays
- Audio Comparison: Compare tracks with similarity scoring
- POST /api/classify - Analyze single audio file
- GET /api/health - Server status check
- GET /api/genres - List supported genres
- Accuracy - 73% (improved ensemble model)
- Featurea - 43 audio characteristics per sample
- Genres - 10 distinct music categories
- Processing - ~2-10 seconds per file (depending on size)
- Automatic uncertainty detection for low-confidence predictions
- Alternative genre suggestions with probabilities
- Visual indicators for prediction reliability
- Real waveform rendering from audio buffer data
- Interactive frequency spectrum analysis
- MFCC coefficient displays
- Beat detection and tempo visualization
- Concurrent batch processing with progress tracking
- Comprehensive export system (JSON, CSV, PDF, text)
- Responsive design for all devices
- Keyboard shortcuts for power users
We welcome contributions! Please feel free to submit pull requests, report bugs, or suggest new features.
This project is licensed under the MIT License - see the LICENSE file for details.
- GTZAN Dataset for genre classification benchmarks
- Librosa library for audio feature extraction
- Web Audio API for browser-based audio processing