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

[Validation] How do you reshape cpp_stft? #12

Open
shreks7 opened this issue Jan 14, 2023 · 2 comments
Open

[Validation] How do you reshape cpp_stft? #12

shreks7 opened this issue Jan 14, 2023 · 2 comments

Comments

@shreks7
Copy link

shreks7 commented Jan 14, 2023

You have this line in the validation notebook -
cpp_stft = cpp_stft.reshape((int(len(cpp_stft)/514), 514))

How do you get the number 514?

Thank you!

@shreks7
Copy link
Author

shreks7 commented Jan 14, 2023

I tried the nearest divisor of len(cpp_stft) however then I get this error -

  File ".\plotTest.py", line 57, in <module>
    validateSTFT(inputAudioFile, inputBinaryFile)
  File ".\plotTest.py", line 41, in validateSTFT
    cpp_stft = cpp_stft[:,0::2] + cpp_stft[:,1::2]*1j
ValueError: operands could not be broadcast together with shapes (290,257) (290,256)```

@kooBH
Copy link
Owner

kooBH commented Jan 14, 2023

wav : [number_of_sample] -> stft[number_of_frame, n_hfft]
n_hfft = (n_fft)/2 +1

when n_fft = 512
n_hfft = 257
since STFT is in complex domian, view as double type array, stft[number_of_frame, 257*2]

and in the memory sequence of data is : real imag real imag
so, to convert into complex type cpp_stft[:,0::2] + cpp_stft[:,1::2]*1j. And it seems one imaginary axis is missing.

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