I'm obtaining MFCC by using the function wave2mfcc from the Speech and Audio Processing library (SAP) from here http://mirlab.org/jang/matlab/toolbox/

The steps follows the procedure:

  • Take the Fourier transform of (a windowed excerpt of) a signal.
  • Map the powers of the spectrum obtained above onto the mel scale, using triangular overlapping windows.
  • Take the logs of the powers at each of the mel frequencies
  • Take the discrete cosine transform of the list of mel log powers, as if it were a signal

As I have previously read, the MFCC are the spectral envelope of the signal, but I don't know how to relate the coefficients with the envelope.

For example, if I have a signal 'example.wav'

[signal fs] = wavread('example.wav'); figure(1); plot(log(abs(fft(signal))); mfcc = wave3mfcc(signal,fs); figure(2); plot(mfcc):

As I understand the MFCC should have the shape of the figure 1, but in my case it doesn't, maybe I'm missing some step.

Can anybody tell me please how to relate them and being able to graph?


1 Answer 1


It would be more accurate to say that the MFCC "capture" or "represent" the spectral envelope - in the sense that two signals with a similar spectral envelope will have a similar sequence of MFCC.

The MFCC coefficients themselves are not supposed to "look" like the spectral envelope when plotted. After all the spectral envelope is a "big" vector (as long as the size of an analysis window), while the MFCC are designed to be short (a handful of coefficients). The spectral envelope is highly redundant (this is a very smooth function, consecutive values are correlated), while the MFCC are, by design, very little correlated.

One could visualize the spectral envelope from the MFCC by inverting all steps in the process except the first one (note that you probably omitted one last step: truncate the vector and keep first 13 or 20 coefficients). The reverse operations would thus be: pad with zeros, compute inverse DCT, take exponential, and compute a matrix product with the matrix containing the triangular bin responses. This will yield a smoothed version of the spectrum that will show what the MFCC "see" of the spectrum.

Finally, unless "example.wav" is very short, there is something wrong in your code. Audio signals are analyzed in short overlapping frames rather than wholly. It's likely that you might instead want to look at spectrograms; and at the MFCC as a 2D matrix (imagesc).

  • $\begingroup$ Great explanation thanks. "example.wav" was just for showing the point, but you are right, MFCC works at frames level. $\endgroup$
    – jessica
    Commented Mar 11, 2014 at 18:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.