speechpy icon indicating copy to clipboard operation
speechpy copied to clipboard

stack frames calculation

Open automatiek opened this issue 5 years ago • 0 comments

Hi Amirsina,

First of all, great project!

I noticed in the mfcc the last frame_length of the signal buffer is always missing. When the number of stack frames is calculated (in the function stack_frames), the sample_buffer is decreased with the frame_length before it is divided in a number of stack frames.

See snippet: https://github.com/astorfi/speechpy/blob/4ece793cc52e36decd60dd89aca25233d773afe6/speechpy/processing.py#L103-L104

On a 1 second sample buffer this is hardly noticeable, but if we run the mfcc on smaller buffers this becomes significant.

If the calculation is done in this way:

    numframes = (int(math.ceil((length_signal
                                  - (frame_sample_length - frame_stride)) / frame_stride)))

The full sample buffer is used if frame_sample_length equals the frame_stride and adjusted correctly on differences between the frame_length and frame_stride.

automatiek avatar Jul 02 '20 19:07 automatiek