Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: STFT and inverse STFT not working for frame length not perfectly divisible by signal length #32

Closed
psambit9791 opened this issue Nov 22, 2021 · 2 comments

Comments

@psambit9791
Copy link
Owner

On running the test: testInverseShortTimeFourierLongSignal1() under TestInverShortTmeFourier, we use the electrocardiogram signal (length = 108000). On using a frame length of 6000, the tests pass; however, if I use a length of 20000, the test fails since the array length differs. The result has a length of 100000 while the expected is 108000.

@psambit9791
Copy link
Owner Author

@SiboVG Could you take a look at this please?

@SiboVG
Copy link
Contributor

SiboVG commented Nov 22, 2021

There is nothing that you can do about this really :/ it's inherent to the (I)STFT algorithm; you split the entire signal up into frames and shift that frame to the end. But if the last portion of the signal does not have enough samples to fill an entire frame, it gets discarded. You can see this in the drawing below; in the beginning of the signal, you can make 3 frames, f0, f1 en f2, but for the end there aren't enough samples to make an entire frame, so this part of the signal is discarded.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants