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
[audio_to_spectrogram] audio_to_spectrum.py publishes wrong amplitude? #2761
Comments
It is a good direction to be able to specify the correct calculation as an option. |
I am sorry for the lack of explanation.
The word "amplitude" is not appropriate. Sorry.. The reason for using log was so that the spectrogram would include even the small sounds. In addition, I used the log scale because I found opinions that it was more suitable for learning or closer to the way humans hear, so I used the log scale.
|
Maybe, the correct thing to do is the following. (But it seems too late...)
|
@708yamaguchi I see, thank you for your explanation.
My understanding is that all of our recognition nodes use spectrogram, not spectrum. Is this correct? |
Thank you for your suggestion.
I have heard of JSK programmers watching spectrum to check the properties of sounds, but I have never heard of an example of inputting spectrum into a recognition node.
I think this is correct. Log scale and mel scale are similar, but they are different. fast-d.hmcom.co.jp/techblog/melspectrum-mfcc. |
Thank you, I'll create a PR introducing the new pipeline.
I'll make both |
I know it is too late to fix this issue even if this issue is correct, so I just write this for reference.
Currently,
audio_to_spectrum.py
calculates "amplitude" by applyingabs
andlog
to FFT result:jsk_recognition/audio_to_spectrogram/scripts/audio_to_spectrum.py
Line 56 in c4df514
However, I think this calculation cannot generate "real" amplitude (consistent with the amplitude of the original signal).
If you want to get "real" amplitude, you have to divide FFT result by
self.audio_buffer.audio_buffer_len / 2
and applyabs
:https://helve-blog.com/posts/python/numpy-fast-fourier-transform/
https://ryo-iijima.com/fftresult/
Unfortunately, if we fix this issue, spectrogram image will change and network learned from previous image will come not to work.
The text was updated successfully, but these errors were encountered: