Skip to content

Latest commit

 

History

19 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Speech Emotion Classifier

A simple project for classifying speech emotion using audio features and machine learning.

Features

  • Extracts audio features (e.g., MFCC, chroma, spectral contrast)
  • Trains and evaluates classifiers with Random Forest Classifier
  • Inference pipeline for single-track emotion prediction
  • Basic web app with Flask and Javascript with uploading/recording feature

Link to the dataset used: https://www.kaggle.com/datasets/uwrfkaggler/ravdess-emotional-speech-audio.

Requirements

  • Python>=3.10, <3.14
  • librosa, numpy, pandas, scikit-learn, matplotlib, flask, etc. See requirements.txt for details.

Quick Start

To launch the web app

  1. Set up virtual env:
# create
python -m venv /path/to/new/virtual/environment
# activate (for windows)
venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Run web app:
python -m web.app

To train and test the model

  1. Prepare audio dataset: create a directory containing subdirectories. Audio files need to in wav format and be put in the subdirectories. change folder path in src/main.py. Example:
kaggle/actor_1  # put audio files inside /actor_1
  1. Train and test model:
# Change directory:
cd src
# Run and visualize training result
python main.py

Next Steps/Possible Expansions

  1. Add commands for single audio emotion classification.

  2. Improve web app user interface.

  3. Denoise before processing audio.

  4. Train more advanced models (e.g. CNN) on audio waveform/spectrograms

Project Structure

speech-emotion-classifier/
├── .gitignore
├── legacy/  # Legacy code
├── model/
│   └── emotion_classifier.pkl
├── README.md
├── requirements.txt
├── src/
│   ├── extract_features.py
│   ├── main.py
│   ├── README.md
│   ├── train_model.py
│   └── waveform_spectrogram.py
└── web/
    ├── app.py
    ├── classify.py
    ├── static/
    │   ├── script.js
    │   └── style.css
    └── templates/
        └── index.html

About

A project using ML to recognize emotions in music audio.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages