-
Notifications
You must be signed in to change notification settings - Fork 16
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
The STFT results of single channel wav don't match with the results of librosa.stft #8
Comments
Can you provide a better test.c file please? |
Since I usually work on STFT to match with my MATLAB algorithms, this code fits with MATLAB routines. But as I remember it matched with |
@kooBH |
Or can you provide the args modification of librosa.stft so I can check the data please? |
Hey @kooBH I find there are lots of padding mode in the librosa.stft, such as constant, edge, linear_ramp, reflect, warp etc. Which one do you use? Does the 'Copy and Shift' part mean padding? |
manually shifted index due to differences in padding. https://github.com/kooBH/STFT/blob/main/valdation/validation.ipynb yet, there is 1e-7 error. |
Hey @kooBH I have seen your validation codes, where the center option of librosa is false. How can I add the padding codes to match the results of librosa when the center option is true? |
Well, when I set shift_size = 256, the error become a little big. Why will you set cpp_stft = cpp_stft[:,7:-1] under the shift_size = 128? |
cpp_stft is for real-time processing
buf most of STFT routines are for wav reading processing where samples for STFT are like
for frame_size = 512, shift_size = 128, which is 25% overlap when you set padding options on and |
wo~ Thank you for your reply! That's a little sophisticated. |
Sadly, I can't make the data match under the setting of
|
https://github.com/kooBH/STFT/blob/main/valdation/validation.ipynb const int ch = 1;
const int rate = 16000;
const int frame = 512;
const int shift = 256;
STFT process(ch,frame,shift); rs_stft = rs.stft(input_wav, n_fft=512, hop_length=256, win_length=512, window='hann', center=True, pad_mode="reflect") |
Hi @kooBH Thank you very much for your patient reply! I find the difference between your validation and mine. You can always find the right slice of cpp_stft, while I can't. BTW, I find the part below can be removed to get the smaller error rate:
|
As mentioned, I set frame_size = 512, and shift_size = 256, and compare your results with that of the librosa.stft. However, I can't find the good match.
The text was updated successfully, but these errors were encountered: