I have a dataset with over 2000 examples of digits (0 to 9) recorded on wav files. I'm trying to process these files with MFCC so that later I could train an Artificial Neural Network (ANN).

My problem is that ANNs requires, each sample of data, to have the same size, and every single tool I tried (HTK, Matlab and others..), generates outputs of different sizes.

This is probably due to the fact that some digits take more time to be pronounced than others. But how could I deal with this? Should I crop then in order to force them to have the same size? Or should I concatenate all of them with '0's, which would also make them with the same size?

I got stuck with the implementation, any suggestion is welcome

  • $\begingroup$ It would be interesting to hear about what you tried since you posted the question and about your experience with it. I don't know whether this is of interest any more, but I myself am curious whether somehow finding the most representative block-wise MFCC vectors (e.g., by means of vector quantization) and using these most representative vectors as input for the neural network would result in acceptable classification performance. $\endgroup$
    – applesoup
    Jan 3, 2019 at 20:14

2 Answers 2


You might try padding the shorter (and even the longer) speech samples with a wide range of different (but realistic) background noise environments to create a larger training set (all to an equal training input size). This might allow the DNN to be trained to be more robust at inference in noise.

You might even want to add variations of noise and a range of slight time-pitch variations to all your dataset samples to enlarge your training set.


Usually, the MFCC/ANN approach is more successful when the signal is processed and evaluated on a frame basis, in a phoneme oriented classification task. This is not your case.

For digit recognition using the whole word you have some simple possibilities:

  • you can zero-pad the words with shorter duration and consider a constant duration for all words
  • you can also cut longer words (only a fraction of the time could be sufficient)
  • you can use statistics over your MFCCs and use these as inputs to your network

(more complex approaches are possible...)

In any case it can be useful to use a voice activity detector to trim non-speech segments in the beginning of the signal.


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.