-
Notifications
You must be signed in to change notification settings - Fork 147
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
Problem with backend.magnitude_to_decibel #121
Comments
Hi, first of all, your understanding about the current implementation is correct. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I think there is an issue with
backend.magnitude_to_decibel()
. This calculates the db value as10 * log10(x)
, wherex
is the magnitude(i.e. x = abs(stft))
.As I understand, the decibel value of the magnitude of a signal should be
20 * log10(x)
not10 * log10(x)
. The latter is the decibel value of the signal power, i.e. it expects:10 * log10(x**2)
.I was confused as it is passing unit tests against librosa, but I think I know why. In
tests.test_backend.test_magnitude_to_decibel()
magnitude_to_decibel()
is being tested againstlibrosa.power_to_db()
which expects power as an input.And in
tests.test_time_frequency.test_melspectrogram_correctness()
the reference melspectrogram is being computed with a power of 1, which I believe returns a magnitude melspectrogram not the power spectrum as is usual.Basically at the moment
backend.magnitude_to_decibel()
is equivalent tolibrosa.core.spectrum.power_to_db()
but I think it should be equivalent tolibrosa.core.spectrum.amplitude_to_db()
, see librosa.core.spectrum.Let me know if I have got the wrong end of the stick here! But if not I am happy to fix this. I just wanted to check that my thinking is correct. The result would be that all spectrograms would be scaled by a factor of two, so while trivial, all spectrogram converted to decibels would change in this way.
Kind regards
Paul
The text was updated successfully, but these errors were encountered: