This device is not compatible.


Recognize Emotions from Speech using Librosa

In this project, we'll explore the Librosa module to get the features from the audio files and then use a classifier to recognize the emotions from the audio files.

Recognize Emotions from Speech using Librosa

You will learn to:

Interact with audio files using a programming language.

Extract different features from the audio files.

Create training and testing datasets from extracted features.

Classify the emotion from audio files.


Machine Learning

Deep Learning


Intermediate knowledge of Python

Basic knowledge of scikit-learn

Basic understanding of machine learning models



librosa logo



Project Description

Librosa is a Python package that analyzes music and audio. Librosa is mainly used with audio data, such as in music generation (via LSTMs) and automatic speech recognition. It provides the building blocks for developing music information retrieval systems.

In this project, we will explore the Librosa package and perform the following operations:

  • Interact with audio files using Librosa.
  • Extract the following features of the audio file:
    • Mel Frequency Cepstral Coefficients (MFCC).
    • Chroma of the audio file.
    • Spectral Scale of the pitch of the audio.

After extracting all the features from the audio file, we’ll create different datasets for training and testing. We will then initialize a new classifier using scikit-learn to classify the audio file features to detect emotions. Finally, we will compute the accuracy of our classifier.

Project Tasks


Explore Librosa

Task 0: Get Started

Task 1: Import Modules

Task 2: Load Audio and Plot Correlation

Task 3: Plot Multiple Waves

Task 4: Feature Extraction

Task 5: Define Dictionary of Labels

Task 6: Get Labels from Features of Audio Files


Create Classifier

Task 7: Import scikit Modules

Task 8: Split the Training and Testing Data

Task 9: Plot the Emotions

Task 10: Initialize the Classifier

Task 11: Classify and Get the Predictions

Task 12: Calculate Accuracy

Task 13: Plot the Loss Curve