For computing Mel Frequency Cepstral Coefficients you can use already calculated STFTs as a basis and perform the Mel frequency mapping on it.

My question: Does it make a significant difference if I calculate the STFTs, perform a PCA-transform on them and then calculate the MFCC compared to computing the PCA-transform at the very end on the MFCCs?

In both cases we have two dimensionality reductions (PCA and MFCC) and I'm not sure weather the order makes a difference.


One dimensionality reduction method (PCA) is linear, the other (MFCC) is not. It is thus unlikely that there is no difference at all since they probably do not commute. One serves more decorrelation, the other feature extraction.

The importance of the order thus depends a lot on your signal class, and what your purpose is.

  • $\begingroup$ Thank you. You're totally right regarding the linearity/ log-scale. I'm just wondering since in literature about music classification PCA is always (if) applied after the MFCCs have been computed. But to allow comparison between lets say a Feature Learning and MFCC-approach (both depending on STFT beforehand) it makes much more sense to me to apply PCA directly on the magnitude spectrum of the STFT....what do you think? $\endgroup$
    – Jamona
    Dec 1 '15 at 16:56
  • $\begingroup$ If you are taking the magnitude of the STFT, this is another non-linear transform. Quite often in signal processing, features (non linear) are extracted first, followed by linear (decorrelation) then non-linear again: think about quantization/transform/compression. I would not use PCA on absolute STFT: others transforms for positive signals like NMF (non-negative matrix factorization) could be more practically useful. $\endgroup$ Dec 1 '15 at 17:41
  • 1
    $\begingroup$ I must admit that I find it hard to understand why NNMF should be better in this case than PCA when talking solely about dimensionality reduction. If I would use it to obtain features, NNMF would be beneficial - but e.g. reducing the dataset to 99% variance, is there really a benefit? Orthogonality and negative coefficients aren't a problem here I think...thanks for your reply! $\endgroup$
    – Jamona
    Dec 1 '15 at 17:55
  • $\begingroup$ The way you want to apply PCA on spectrograms is not clear to me yet. A spectrogram yields a rectangular matrix. Then, in many cases, PCA sounds more natural to me on symmetrically-distributed data. Which spectrograms are not. Cusps due to time-frequency zero-crossing somehow render SFTF not stationnary. Back to the actual question: what do you really want to do? $\endgroup$ Dec 1 '15 at 18:42
  • 2
    $\begingroup$ Actual question: Does the order make a difference: STFT -> MFCC -> PCA or STFT -> PCA -> MFCC. And if yes, what difference? Since the PCA applied on STFTs is applied on much more data I expect the outcome more relevant than on already compressed MFCCs. (It's clear that the STFT-matrix will be flattened first and multiple STFTs will be stacked together to form the matrix for PCA. Surely data will be normalized.) $\endgroup$
    – Jamona
    Dec 1 '15 at 19:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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