GithubHelp home page GithubHelp logo

filiptirnanic96 / mfcc_extraction Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 1.0 47.79 MB

Implementation of Mel-Frequency Cepstral Coefficients (MFCC) extraction

Python 100.00%
audio-classification audio-processing mfcc-algorithm mfcc-extractor mfcc-features signal-processing-algorithms mfcc-analysis

mfcc_extraction's Introduction

Mel-Frequency Cepstrum Coefficients (MFFC)

Table of contents

  1. Introduction
  2. Mel-Frequency Cepstrum Coefficients Algorithm
  3. MFFC results
  4. Cats and Dogs audio classification

Introduction

Mel-Frequency Cepstral Coefficients (MFCC) comes from combines two analysis: Cepstral and Mel-Frequency Analysis.

   1. Cepstral Analysis aims to extract envelop of signal which carries the most relevant information. It uses IFT (Inverse Fourier Transformation) and LPF (Low Pass Filter) to extract coefficient representing signal envelop of Log Power Signal Spectrum.

  
   2. Mel-Frequency Analysis treats signal as human auditory system. It passes Signal spectrum though Mel filter which estimates human auditory system filtering. Example of Mel filter is presented in the picture below.

  

Mel-Frequency Cepstrum Coefficients Algorithm

MFCC algorithm is composed of 8 steps:

   1. Framing - Signal is framed into chunks often with length of 20-40ms
   2. Windowing - Frames are windowed with Hamming window
   
   3. Calculating Power Spectrum of each frame
   
   4. Filtering each Power Spectrum with Mel filter
   5. Covert Mel Spectrum from amplitude to dB
   6. Using DCT2 transformation on each Mel Spectrum
   
   7. Liftering of MFCC using sin window
   
   8. Taking 2. - 13 coefficient

Details of implementation can be found in scipts ./core_functions/mffc_feature_extraction.py and ./core_functions/mffc_utility_functions.py.

MFFC results

Algorithm results are compared to mfcc extraction algorithm from librosa package. One representative signal (cat audio sample) is used as input signal and Spectrograms and MFFCs are generated using both algorithms (implemented one and librosa). Results, generated using script ./main_scrips/compare_impl_vs_librosa_mffc.py, are shown below.

   - Input signal
   

   - Spectrograms
       

   - MFCCs
       

Cats and Dogs audio classification

The classification of Cats and Dogs audio dataset are preformed using implemented MFCCs extraction algorithm for feature extraction. Implementation can be found in script ./main_scrips/cats_and_dog_classification.py. Data used for training and testing the classifier can be found in folder ./data/. Classification is performed using next steps:
   1. Load train and test data
   2. Pad data to same length
   3. Extract MFFC from data
   4. Reduce dimensionality with PCA to 30 components
   5. Train and test LogisticRegression classifier

Classifier reached 93% accuracy on train and test data. Confusion matrices are presented below:


mfcc_extraction's People

Contributors

filiptirnanic96 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

sihamheddi-rfia

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.