I've started to implement an MFCC algorithm on an embedded DSP, using the CMSIS DSP library. However the results I'm getting don't appear consistent. This is my algorithm so far:

  1. Gather 32ms PCM sample from microphone, 512 samples long. 16000hz
  2. Apply a Hamming window.
  3. Compute the 512 FFT using this.
  4. Compute the magnitudes to get power spectrum.
  5. Generate a set of 30 filter banks - using 32 points on the mel spectrum
  6. Convert my power spectrum magnitudes from 16bit ints to floats.
  7. Get the dot product for each filter with the power spectrum.
  8. Log each dot product.
  9. This is the uncertain part. The DSP library I'm using only has DCT IV, and this only supports sizes 128 and up. My set of logs is 32. So I've opted to use a Real FFT function, the results I get from this vary quite a lot. If I speak the same word in the same tone.

Could this be what is hampering my result? Real FFT provides an output of both real, complex and conjugate data (described in link above) - which would I use for the MFCC? - Should I even expect my MFCCs to be similar or is it expected to vary a lot? My results tend to vary between -20.0 and 20.0.

Thanks in advance.


1 Answer 1


For the computation of MFCC's you usually use a DCT-II. Just implement it yourself if you can't find a proper implementation anywhere. You only have relatively few log spectral values, and probably even fewer DCT coefficients that you will use, so I hope that computational complexity will be no big issue. This document is a nice overview of all the steps necessary for obtaining MFCC's.

  • $\begingroup$ Thanks, I've tried to implement DCT-II but all my results appear to change depending on the amplitude. My DCT-II implementation looks like this, any thoughts? $\endgroup$
    – jub
    Mar 21, 2014 at 12:41
  • $\begingroup$ EDIT: Updated code, here $\endgroup$
    – jub
    Mar 21, 2014 at 12:48

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.