3

Today i'm using MFCC from librosa in python with the code below. It gives an array with dimension(40,40).

import librosa

sound_clip, s = librosa.load(filename.wav)
mfcc=librosa.feature.mfcc(sound_clip, n_mfcc=40, n_mels=60)

Is there a similiar way to extract the GFCC from another library? I do not find it in librosa.

For example essentia:

https://essentia.upf.edu/documentation/essentia_python_tutorial.html https://essentia.upf.edu/documentation/reference/std_GFCC.html

import essentia
import essentia.standard

essentia.standard.GFCC

#Get array with dimension (40,40)
gynther
  • 69
  • 1
  • 9

2 Answers2

4

I have been facing similar problems, therefore I wrote a small library called spafe, that simplifies features extractions from audio files. Among the supported features there is GFCC. The extraction can be done as in the following:

import scipy
from spafe.features.gfcc import gfcc

# read wav 
fs, sig = scipy.io.wavfile.read("test.wav")

# compute features
gfccs = gfcc(sig, fs=fs, num_ceps=13)

You can find a thorough example of GFCC extraction (as a jupyter-notebook) under gfcc-features-example.

The documentation of all the possible input variables and their significance are available under: gfcc-docs.

the gfcc implementation is done as in the following paper enter image description here

SuperKogito
  • 2,998
  • 3
  • 16
  • 37
  • how could I determine the output shape? I mean num_ceps can be computed by paramater num_ceps, but how to get the number of num_frames? Also, I noticed that the result of your function is the transpose of the result of librosa, is that right? – WWH98932 Jul 16 '20 at 03:36
  • you can figure out the shape of your output matrix using `gfccs.shape`, this will return the 2d-output matrix shape `(m, n)`, where (m=number of frames , n=num_ceps). The number of frames can be computed from the input wave duration `= len(sig)/fs`, the fames length `win_len` and the frames overlap `win_hop`. – SuperKogito Jul 18 '20 at 07:47
  • Hi SuperKogito, can you please tell me where to find gtcc features extraction code? Can I use gfcc instead of gtcc? Thanks – DevLoverUmar Jun 11 '21 at 18:51
  • This is the code: https://github.com/SuperKogito/spafe/blob/master/spafe/features/gfcc.py Can you please rephrase the second question. – SuperKogito Jun 11 '21 at 21:32
0

https://github.com/jsingh811/pyAudioProcessing provides gfcc, mfcc, spectral and chroma feature extraction capability along with classification, cross validation and Hyperparameter tuning. The readme describes getting started methods as well as examples on how to run classifications.