dspavankumar / compute-mfcc

A simple MFCC extractor using C++ STL and C++11
GNU General Public License v3.0
116 stars 34 forks source link

why extract frameShiftSamples samples as a frame? #8

Closed wweihang closed 4 years ago

wweihang commented 4 years ago
    // Recalculate buffer size
    bufferLength = frameShiftSamples;
    buffer = new int16_t[bufferLength];

    // Read data and process each frame
    wavFp.read((char *) buffer, bufferLength*bufferBPS);
    int frame = 0;
    while (wavFp.gcount() == bufferLength*bufferBPS && !wavFp.eof()) {
        frame += 1;
        mfcFp << processFrame(buffer, bufferLength);
        wavFp.read((char *) buffer, bufferLength*bufferBPS);
    }

  is frameShiftSamples equal to winLengthSamples?

dspavankumar commented 4 years ago

At any time instant, the number of "new" samples we need to see to construct a frame is the last frameShiftSamples samples of the frame. The rest of the samples are overlapped with those from the previous frame, which we already have in memory. Hope this helps.