A web application that predicts music genres, extracts audio features, and recommends similar songs based on machine learning.
- Welcome Page: Modern animated landing page (Urban Beatzs) with quick navigation
- Contact Form: Users can send feedback or queries (saved to
contacts.json) - About, Genre Analysis, Audio Features Pages: Informative pages for users
- Genre Prediction: Analyzes audio files to predict music genre using a TensorFlow/Keras model
- Audio Feature Extraction: Extracts energy, danceability, loudness, and more
- Song Recommendations: Suggests similar songs based on genre and audio features
- YouTube Integration: Downloads songs directly from YouTube for analysis
- Audio Playback: Built-in player for uploaded/downloaded songs
- Genre Fun Facts: Displays a random fun fact, tip, and icon for each predicted genre
- Modern UI: Animated visualizer, responsive design, and toast notifications
The application uses a trained TensorFlow model that can classify songs into 10 genres:
- Blues
- Classical
- Country
- Disco
- Hip-Hop
- Jazz
- Metal
- Pop
- Reggae
- Rock
- Backend: Python, Flask
- Machine Learning: TensorFlow, Keras
- Audio Processing: librosa, soundfile
- Data Analysis: pandas, scikit-learn
- Frontend: HTML, CSS, JavaScript
- External Tools: yt-dlp for YouTube downloads
MusicRecommender/
βββ app.py # Main Flask application
βββ extract_features.py # Audio feature extraction
βββ recommend.py # Song recommendation system
βββ requirements.txt # Python dependencies
βββ data/ # Dataset for recommendations
βββ model/ # Trained ML model
βββ static/ # CSS, JS, images, videos
β βββ style.css # Main styles
β βββ main.js # Main JS logic
β βββ navbar.js, navbar.css
β βββ ...
βββ templates/ # HTML templates
β βββ welcome.html # Animated landing page
β βββ index.html # Main page with player and song list
β βββ result.html # Results page with predictions
β βββ about.html # About page
β βββ contact.html # Contact form
β βββ genre-analysis.html# Genre info
β βββ audio-features.html# Audio features info
β βββ 404.html, 500.html # Error pages
βββ uploads/ # Uploaded and downloaded audio files
βββ utils/ # Helper functions
β βββ file_utils.py # File handling utilities
β βββ model_utils.py # Model prediction utilities
βββ genre_facts.json # Fun facts, tips, and icons for each genre
βββ contacts.json # Stores contact form submissions
βββ ...
/: Welcome page (Urban Beatzs)/index: Main app (upload, play, analyze, download)/about: About the project/contact: Contact form/genre-analysis: Genre info/audio-features: Audio features info/download: POST endpoint for YouTube song download/uploads/<filename>: Serve uploaded/downloaded audio
- Python 3.8+ to Python 3.10
- pip
- yt-dlp (for YouTube downloads)
- 4GB RAM minimum
- 2GB free disk space
- Internet connection for YouTube downloads
- Clone the repository:
git clone https://github.com/yourusername/MusicRecommender.git cd MusicRecommender
- Create and activate a virtual environment:
python -m venv env .\env\Scripts\Activate.ps1 - Install dependencies:
pip install -r requirements.txt pip install yt-dlp
- Run the app:
python app.py
- Open your browser at http://127.0.0.1:5000
[Add screenshots or GIF of your application in action]
- Invalid audio file formats
- Failed YouTube downloads
- Network connectivity issues
- File permission errors
- Memory limitations
- Custom 404 and 500 error pages
- YouTube Download Fails: Update yt-dlp, check internet, try a different URL
- Audio Analysis Error: Use supported formats (MP3, WAV), check file integrity, ensure enough memory
- Model Prediction Issues: Clear browser cache, restart app, check model files in
/model
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit changes (
git commit -m 'Add AmazingFeature') - Push to branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Music player with controls and animated visualizer
- List of uploaded/downloaded songs (with search)
- YouTube search and download
- Song analysis button
- Predicted genre with confidence scores
- Extracted audio features (energy, danceability, loudness, etc.)
- Song recommendations
- Random fun fact, tip, and icon for the genre
- Modern animated welcome page
- About page with project and tech info
- Contact form (saves to
contacts.json) - Genre and audio feature info pages
- Results page displays a random fun fact, tip, and icon for each predicted genre, loaded from
genre_facts.json - Each genre has multiple unique facts/tips
- Backend randomly selects a fact for the predicted genre and passes it to the UI
- Edit
genre_facts.jsonto add or update facts, tips, or icons for any genre
- Animated confidence bars, genre icons, and a visually engaging, rhythm-inspired layout
- Responsive design for desktop and mobile
- Toast notifications for user feedback
- Backend is API-ready and can be connected to a React frontend in the future
- Upload or Download: Add songs by uploading files or downloading from YouTube
- Select and Play: Choose a song to play in the built-in player
- Analyze: Click "Analyze Song" to process the selected song
- View Results: See the predicted genre, audio features, recommendations, and fun facts
This project is licensed under the MIT License - see the LICENSE file for details.
-
librosa for audio processing
-
TensorFlow for machine learning
-
Flask for web framework
-
yt-dlp for YouTube downloads
-
Disclaimer: This project was developed independently by the authors as a part of an academic course project. No institutional resources were used, and no intellectual property agreement was signed with the university. The authors retain full ownership under the MIT License.
-
Β© 2025 Urban Beatzs Project Authors. All rights reserved.