I have computed 12d-MFCC features on 3 consecutive audio frames, say:

For 1st frame: a1 a2 a3 ... a12
For 2nd frame: b1 b2 b3 ... b12
For 3rd frame: c1 c2 c3 ... c12

How to organize these MFCC features, in a1 a2 ... a12 b1 b2 ... b12 c1 c2 ... c12 or a1 b1 c1 ... a12 b12 c12? Is there any difference between these two organization styles (for audio processing)?


Natural order would be to save it on frame by frame basis - that's the way you calculate them, otherwise you would need some gymnastics to do so. What's more, each 12 coefficients will be one vector in your 12D space - frame after frame.

Also it is easier to manage that in memory. In MATLAB like environments you simply use the matrices to store each vector in separate column. For C++, you can use array and array of pointers:

float **frames;
float  *data;
frames = new float*[num_frames];
data   = new float*[12 * num_frames];

After that you just set all frames pointers to first coefficient in each frame and you have easy way to access your features by using frames.

With interleaved features it wouldn't be so easy.

| improve this answer | |
  • $\begingroup$ Please don't promote heavily outdated C++ style. We use std::vector<std::array<float,3>> nowadays. And between 1998 and 2011 we'd have used std::vector<std::vector<float> >. This form hasn't been appropriate for almost 2 decades. $\endgroup$ – MSalters Oct 17 '14 at 18:28
  • 1
    $\begingroup$ @MSalters: I believe it is not a place to argue about programming details, isn't it? This code is an example of usage - instead of any pseudo-code. $\endgroup$ – jojek Oct 18 '14 at 10:26

If you interleave your data you will have hard time adding new entries. Otherwise it make no differences.

| improve this answer | |

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