# What is the purpose of the log when computing the MFCC?

The steps of computing the Mel-Frequency Cepstrum Coefficients (MFCC) are:

Frame blocking -> Windowing-> abs(DFT) -> Mel filter bank-> Sum coefficients for each filter-> Logarithm -> DCT


But what is the purpose of the logarithm step?

The logarithm serves to transform a multiplication into an addition. It is part of the computation of the cepstrum. The basic idea is as follows:

Assume a source signal $x$ is convolved by some impulse response $h$. The resulting magnitude spectrum is

$$|Y(\omega)| = |X(\omega)||H(\omega)|$$

By applying the logarithm we get

$$\log |Y(\omega)| = \log |X(\omega)| + \log |H(\omega)|\tag{1}$$

If we want to equalize / undo the effect of filtering by $H(\omega)$ we can hope that this task is easier if we transform the convolution into additive noise. This is exactly what happens by taking the logarithm in (1).

• Hi Matt thanks for your answer. So the advantage is that I can remove impulse response h, as substraction? Should that substraction be performed after the DCT is computed? Apr 26, 2013 at 11:23
• Yes, it is usually performed after the DCT, i.e. on the cepstral coefficients. It is a standard method used in speech recognition front ends, called 'Cepstral Mean Normalisation (CMS)' (or 'mean subtraction'). Apr 26, 2013 at 12:53
• So DCT and mean subtraction are commutable. But if you do not perform mean subtraction, then log could (theoretically) be left out, or is there other usefull effects of it e.g. smoothing the data? Apr 27, 2013 at 12:58
• Yes, in principle they are commutable, but normally there are fewer DCT coefficients than filter bank outputs, so it's more efficient to do CMS after the DCT. The function of the log operation is also to compress the data in a way similar to the human auditory system. Apr 27, 2013 at 13:38
• @ZikO: You need the mean of the log-values. That's the whole idea, because only in the log-domain does the channel become an additive stationary noise component, which can be removed by mean subtraction. Mar 11, 2015 at 14:32