Cannot provide a (Hamming) window to extract mfccs on Windows
See original GitHub issueHello, guys. I am not sure wether this is a librosa or general Python issue, but:
Description
I tried to extract mfccs using a Hamming-window for my thesis’ machine learning project, but my script ran into a TypeError (Traceback below). This behaviour occured (in my case) only on Windows so far (tried it out with two different computers now), on Mac it worked like a charm. I tried finding a solution by posting a question on Stackoverflow, but there’s no solution yet. Another person commented this week that it also happens on Google Collab, but I have no further information related to his environment.
Steps/Code to Reproduce
import librosa
from scipy.signal import get_window
# load file
filename = librosa.util.example_audio_file()
y, sr = librosa.load(filename)
# calculate mfccs
melspec_args = {"n_fft": 160, "hop_length": 80, "window": get_window("hamming", 160)}
mfccs = librosa.feature.mfcc(y=y, sr=sr, S=None, n_mfcc=12, **melspec_args)
print(mfccs.shape)
Expected Results
The script should print the dimension of a multidimensional numpy-array created by librosa.feature.mfcc().
Actual Results
Error-Traceback:
Traceback (most recent call last):
File "C:/Users/Fiona/PycharmProjects/librosaTest/mfcc_test.py", line 7, in <module>
mfccs = librosa.feature.mfcc(y=y, sr=sr, S=None, n_mfcc=12, **meltspec_args)
File "C:\Users\Fiona\Anaconda3\envs\librosaTest\lib\site-packages\librosa\feature\spectral.py", line 1442, in mfcc
S = power_to_db(melspectrogram(y=y, sr=sr, **kwargs))
File "C:\Users\Fiona\Anaconda3\envs\librosaTest\lib\site-packages\librosa\feature\spectral.py", line 1534, in melspectrogram
mel_basis = filters.mel(sr, n_fft, **kwargs)
TypeError: mel() got an unexpected keyword argument 'window'
Versions
Windows-10-10.0.18362-SP0 Python 3.7.6 (default, Jan 8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)] NumPy 1.17.3 SciPy 1.3.1 librosa 0.6.3
Thank you very much. 😃
Edit/PS: I also created a GitHub repository to share the example and my environment’s configuration. It can be found at https://github.com/Keanri828/librosa_mfcc_WindowsError .
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (4 by maintainers)
Top GitHub Comments
I don’t know. I only installed pandas before trying to install librosa. And why does it work on my Mac then? It was the only computer that could execute my mfcc-extraction-code. In the beginning of my thesis’ phase I added the information extracted via librosa to a pandas.DataFrame and filtered them / created subsets for training/evaluation. I really have no more ideas what the underlying problem is.
I think this has to be something deeper in the dependency chain of conda-forge packages on windows.
Let’s migrate the issue over to the librosa feedstock, and then I can maybe tag in some conda-forge folks to help diagnose it. Sorry for the hassle here!