This project focuses on classifying audio files into different genres using the K-Nearest Neighbors (KNN) algorithm.
This project's aim was to utilize KNN to predict the genre of an audio input based on its features extracted using Mel Frequency Cepstral Coefficients (MFCC). It also incorporates a Streamlit user interface for easy interaction. To enhance user experience, the project integrates with the Spotify API to recommend playlists based on the predicted genre. By leveraging Spotify's vast music library, users can discover curated playlists tailored to their genre preferences. The authentication process is streamlined using SpotifyClientCredentials, ensuring seamless access to Spotify's features.
- We are utilizing the GTZAN Dataset available on Kaggle for training and testing our genre classification model.
# cloning the repository
git clone https://github.com/jubinjacob03/genre-classification-recommendation_Spotify.git
# navigating to the directory of cloned repository
cd your-repository
Important
Since the Data for training ( GTZAN Dataset ) is already included in this project, therefore cloning of this repository will take some time !!!
# installing all the required packages
pip install requirements.txt
Caution
Before deploying the application, ensure to add your Spotify API credentials ( Client ID, Client Secret and Redirect URI )
in line 18 , 19 & 20
of app.py. Failing to do so will result in authentication errors when accessing the Spotify API. Refer to the Spotify API documentation for instructions on obtaining and managing your credentials.
streamlit run app.py
Warning
This model is trained to work on only plain audio files as an input. When using vocals, the model might fail
- Python Speech Features: Library for extracting features from speech signals, including MFCC.
- Scipy: Scientific computing library for working with audio files and mathematical operations.
- Numpy: Fundamental package for numerical computing in Python.
- Scikit-learn: Machine learning library for implementing KNN classifier and evaluation metrics.
- Matplotlib: Visualization library for creating plots and charts.
- Seaborn: Statistical data visualization library based on Matplotlib.
- Streamlit: Interactive web application framework for building ML and data science projects.
- Spotify Developer Documentation: Official documentation for the Spotify API, providing comprehensive guides, reference, and examples for integrating Spotify features into applications.
- Spotipy Documentation: Spotipy is a Python library for accessing the Spotify Web API. Its documentation offers guidance on authentication, querying Spotify's endpoints, and handling responses.