# How to combine/append mfcc features with rmse and fft using librosa in python 2.7

I have an audio file say myfile.wav

I trained a neural network based on fft features, and it is giving pretty good results for detecting particular classes of sounds.

I want to expand above experiment to include more sophisthicated features like MFCC along with simpler features like RMSEnergy and so on.

Using librosa,

I can compute mfcc as follows:

import librosa
y, sr = librosa.load('myfile.wav')
mfcc=librosa.feature.mfcc(y=y, sr=sr)
print mfcc.shape
(20,5911)


Similarly I can compute rmse as follows:

myrmse = librosa.feature.mfcc(y=y)
print myrmse.shape
(1,5911)


Q1. Is it valid if I transpose mfcc and the myrsme and combine the two using numpy.hstack ?

say

t = mfcc.transpose()
t2 = myrmse.transpose()


So that I now have two arrays : one of size (5911,20) and another of size (5911,1) and

t3 = numpy.hstack((t,t2))


Q2. If above operation is valid, how do I append more features to t3 , Ex: SNR , FFT and other audio features.
I'm particularly interested in combining fft with mfcc.

END GOAL My plan is to have feature data like this :

feat_1  feat_2 ...feat_20  rmse  feat_21 ...feat_n  label
val     val        val      val     val        val      x
val     val        val      val     val        val      x
val     val        val      val     val        val      y
val     val        val


feat_1 .. feat_20 are mfcc related features.
rmse is rms energy from librosa
feat_21 could be some other thing like fft or SNR.

I want to train a ANN and see which combination of features work best for detecting a particular class of sound. And conclude if mfcc's / fft's alone is sufficient for achieving this.

If this is not the right forum kindly direct me to the correct place.

Thank you.

• It has the same length so just stack them into 21, 5911 vector. Anyway, RMS energy is pretty much the same as 0’th MFCC coefficient, so no point in using them both. – jojek Feb 14 '18 at 6:55
• ok thanks, guess I need to read my theory properly and then jump into all these things. – kRazzy R Feb 14 '18 at 22:08