-
Notifications
You must be signed in to change notification settings - Fork 930
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
centroid is calculated alwais using hanning window #1837
Comments
There is also a related issue with this. spectral centroid always recomputes the spectrogram even if it is provided as parameter. The normal behaviour should be not to recalculate spectrogram S if provided |
Thanks for noting this. I believe the code actually is correct here, but it's not obvious upon a first read through. Here's what's happening:
It's true that the code would be more readable if all parameters were correctly passed through to |
If spectral bandwidth is requested with other window than hamming, the spectral centroid should be calculated using that window.
The following code in the function should be fixed:
# centroid or center?
if centroid is None:
centroid = spectral_centroid(
y=y, sr=sr, S=S, n_fft=n_fft, hop_length=hop_length, freq=freq
)
should be:
# centroid or center?
if centroid is None:
centroid = spectral_centroid(
y=y, sr=sr, S=S, n_fft=n_fft, hop_length=hop_length, freq=freq, window = window
)
The text was updated successfully, but these errors were encountered: