Skip to content

Project for classifying audio files into different genres using the K-Nearest Neighbors (KNN) algorithm.

Notifications You must be signed in to change notification settings

jubinjacob03/genre-classification-recommendation_Spotify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Genre Classification using KNN

This project focuses on classifying audio files into different genres using the K-Nearest Neighbors (KNN) algorithm.

Introduction

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.

Dataset

  • We are utilizing the GTZAN Dataset available on Kaggle for training and testing our genre classification model.

Code execution

# 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

Main Packages Used

  • 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 API Documentation

  • 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.

About

Project for classifying audio files into different genres using the K-Nearest Neighbors (KNN) algorithm.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages