# Matlab Speech Recognition - Mel-Frequency Cepstrum Coefficient (MFCC)

I'm following this Matlab Speech recognition tutorial.

I'm stuck on page 5 on the term/concept of MFCC feature vectors. I'm unable to grasp the concept of what an MFCC is.. a matlab function, formula, etc?

I would appreciate if someone has an understanding of this topic and would shed some light. Thanks ahead of time.

-
I need that tutorial on MFCC but the link is no longer working. Can you please help me out? – user62790 Feb 18 '13 at 10:25
(Years later, 2 links:) Wikipedia links to a nice clear 6-page tutorial; and dsp.stackexchange.com/questions/tagged/mfcc – denis Oct 11 '13 at 11:26

In general a "feature vector" is a list of values (numbers) that contain the relevant features of your signal for some specific task (here, use as input to a speech recognitizion algorithm) in some efficient and expressive way.

Some concrete examples. Suppose that, at the first step in your procedure, you divide your audio signal (say, 24khz, mono signal) in "frames" (fragments of fixed length, say 50 ms). Your are going now to build an appropiate "feature vector" for each one of this frames.

A frame here is composed of 1200 samples, which you store (say) in a row matrix in Matlab. Well, I could considered this matrix already as a "feature vector" (it certainly represents the audio signal: each number is the audio intensity as a function of time). But this "trivial" vector is not very apt: because they are too many numbers and because they are not in themselves very 'expressive': I want to distinguish a vowel from a consonant, for example, and this 1200 numbers say little about it; the same speaker saying the same vowel will probably produce a two such vectors that are very different. I dont want that.

A first transformation, that will give us a more useful feature vector, is the Fourier transform (or rather, the spectogram) of the audio. You probably have the basic idea (from music: graphic equalizers, etc). Instead of having a list ("vector") of 1200 samples (each for a instant of time) I now have a "vector" of (say) 128 numbers that tell me how much energy the audio has in each "frequency band" (always inside the frame). This is more efficient (less numbers) and expressive (perhaps I can start roughly distinguishing vowels and consonants, male vs female voices, etc, just by looking at this numbers).

From this other transformation follows (MEL: change the scale of the frequencies; CEPSTRUM: log followed by inverse Fourier transform -or rather DCT, conceptually similar here- ) and finally you trim the least important elements from your feature vector. Each step gives you a different feature vector, hopefully more efficient/expressive than the previous one. The whole procedure can sound a little complex and esotheric, if are not familiar with all this. But conceptually, from the point of understanding what means to compute a suitable "feature vector", these last steps are conceptually analogous with the first one.

-

MFCC stands for "mel frequency cepstral coefficients". The mel frequency is used as a perceptual weighting that more closely resembles how we perceive sounds such as music and speech. For example, if you are listening to a recording of music, most of what you "hear" is below 2000 Hz - you are not particularly aware of higher frequencies, though they also play an important part in audio perception.

The cepstrum is the spectrum of a spectrum. A spectrum gives you information about the frequency components of a signal. A cepstrum gives you information about how those frequencies change.

The combination of the two, the mel weighting and the cepstral analysis, make MFCC particularly useful in audio recognition, such as determining timbre (i.e. the difference between a flute and a trumpet playing the same frequency, say A440), which forms the basis of instrument or speaker recognition.

-

Wikipedia has a decent explanation. There's also this tutorial.

In short, you want to compress/encode an audio signal. Your first divide it into overlapping short bits (using what are called windows), and then compute the Fourier transform. You correct it to account for human pitch perception (Mel-Frequency), and then you compress it by computing a DCT (which is similar to DFT) and storing only the higher-order coefficients. From a quick glance of the above sources, I can't understand why using the DCT is a good idea - maybe it cancels the effect overtones.

-