calculate MFCC

Discussion in 'Programmer's Corner' started by MFC++, Apr 4, 2009.

  1. MFC++

    Thread Starter New Member

    Apr 4, 2009
    4
    0
    Hi,
    I'm new to audio processing, so I'm hoping someone can help guide me. I'm using C# with Fmod. I'd like to find the MFCC of an MP3 file. How would I go about doing this? Here's what I got from Wikipedia, and my psuedocode for it:
    1) Take the Fourier transform of (a windowed excerpt of) a signal.
    Code:
    I use getSpectrum with the FMOD_DSP_FFT_WINDOW_TRIANGLE parameter

    2)Map the powers of the spectrum obtained above onto the mel scale, using triangular overlapping windows.

    I go through the spectrum array and use this equation on each value:
    Code:
    mel = 1127.01048log e (1+f/700)


    Take the logs of the powers at each of the mel frequencies.
    I then go through the new mel-array and take the log of each :
    Code:
    mLog = (Math.log(melArray))


    Take the discrete cosine transform of the list of mel log powers, as if it were a signal. (Then find amplitude of DCT result)
    I'm not sure what I do here. How do I calculate the DCT?

    Thanks for any help. If you know any source code for the DCT (pref. .NET/Java), it would be much appreciated.
     
  2. MFC++

    Thread Starter New Member

    Apr 4, 2009
    4
    0
    Hi,
    Just a follow up question. Does anyone know of any tools which could do the above for me? I just need to find the MFCCs of an MP3 file. It doesn't have to be open source program.
    Thanks
     
  3. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
  4. MFC++

    Thread Starter New Member

    Apr 4, 2009
    4
    0
    Hi thatoneguy
    Thanks for the reply. I can encode/decode MP3 files, but I have around 1000 sample MP3's to test, and converting them to WAV would take quite a while, as well as taking up hard drive space (which is limited for me as I'm on a network machine). Unless I'm mistaken, I can't use LAME to find MFCCs?
     
  5. MFC++

    Thread Starter New Member

    Apr 4, 2009
    4
    0
    Ok, I've started to use Matlab's Voicebox toolkit. I use the melcepst.m function, which retrieves two columns (stereo) of MFCCs. However, I need it to output 13 coefficients instead of the long list it comes up with. I must be missing something in order to get 13 coefficients (even though I've specified it in the parameters). Anyone have any ideas?
    Thanks
     
  6. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    I mentioned LAME as you were looking in the source code. I haven't dug into it deeply, but there are seveal functions in code commented out for future releases once the bugs are fixed.

    One section might have a great example of accomplishing your tras. The best manual I've ever found for a program, manual, orOS is the source code. :)
     
Loading...