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

Fix: [Spectrogram] Resample spectrogram at Mel frequencies without ch… #3861

Merged
merged 1 commit into from
Sep 9, 2024

Conversation

lucastheis
Copy link
Contributor

@lucastheis lucastheis commented Sep 9, 2024

This changes melFilterBank such that power spectra are correctly resampled.

Short description

The way that melFilterBank is computed now, the Mel spectrogram is not calculated by linearly interpolating the linear spectrogram at nearby frequencies. Instead, it computes a weighted average where the sum of weights depends on the frequency. One consequence of this is that the Mel spectrogram of white noise does not appear to be white.

Implementation details

The Mel spectrogram is now calculated by resampling and linearly interpolating the linear spectrogram.

Screenshots

Spectrogram of Gaussian white noise before:
mel_spectrogram_before

Spectrogram of Gaussian white noise after:
mel_spectrogram_after

melFilterBank before:
filterbank_before
sums_before

melFilterBank after:
filterbank_after
sums_after

Checklist

  • This PR is covered by e2e tests
  • It introduces no breaking API changes

Copy link
Owner

@katspaugh katspaugh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@katspaugh katspaugh merged commit 4647779 into katspaugh:main Sep 9, 2024
2 checks passed
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

Successfully merging this pull request may close these issues.

2 participants