Skip to content

saranicoly/RECM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

RECM - Music Genre Classificator

Introduction

This project aims to develop a music genre classification model based on audio analysis. A dataset containing recordings of different musical genres was used to extract relevant features to train a classifier.

Methodology

1. Dataset

The dataset used is GTZAN, which contains audio files from 10 musical genres (blues, classical, country, disco, hip-hop, jazz, metal, pop, reggae, and rock).

2. Preprocessing

The GTZAN dataset has already been processed, but for the classifier to work with user-input audio, additional preprocessing is required to handle noise, background sounds, and echoes.

Steps taken:

  • Signal normalization: Adjusting the signal amplitude to a standardized range to prevent extreme volume variations from affecting feature extraction.
  • Noise removal:
    • Low-pass filter: Reduces high-frequency noises such as hissing and whistling.
    • Spectral Gating: Removes constant background noise.

Audio Before Preprocessing
Audio Before Preprocessing

Audio After Preprocessing
Audio After Preprocessing

3. Feature Extraction

RandomForest was used to evaluate the most relevant features for classification. The 20 most important features were selected, and a correlation matrix was applied. Features with a correlation above 75% were removed, resulting in a final set of 12 features.

Correlation Matrix
Correlation Matrix

4. Model Training

A RandomForest classifier was trained with 80% of the data, while the remaining 20% was used for validation.

Results

After training and testing, the model achieved 73% accuracy, demonstrating good performance even with noisy audio inputs.

Confusion Matrix
Confusion Matrix

Classification Report
Classification Report

How to Run

To run this project, follow these steps:

  1. Open the recm.ipynb file in a Jupyter Notebook or Google Colab.
  2. Generate an API key on Kaggle.
  3. Download the kaggle.json file and upload it to the notebook.
  4. Run all the cells in the notebook.

To test the model with an audio file, simply upload your audio file in the notebook (the code specifies where to do this).

That's it! 🚀 Feel free to contribute.

About

Reconhecedor de estilos musicais usando RandomForest.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published