Created
May 9, 2020 20:18
-
-
Save DalyaG/48367a5fd3b4355fb1be45195489e1f9 to your computer and use it in GitHub Desktop.
Sanity Check for Mel Spectrogram Computation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sanity check that indeed we understood the underlying pipeline | |
S = librosa.feature.melspectrogram(whale_song, sr=sr, n_fft=n_fft, hop_length=hop_length, n_mels=n_mels) | |
fft_windows = librosa.stft(whale_song, n_fft=n_fft, hop_length=hop_length) | |
magnitude = np.abs(fft_windows)**2 | |
mel = librosa.filters.mel(sr=sr, n_fft=n_fft, n_mels=n_mels) | |
assert (mel.dot(magnitude) == S).all() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment