question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot provide a (Hamming) window to extract mfccs on Windows

See original GitHub issue

Hello, 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:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Keanri828commented, Jan 16, 2020

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.

0reactions
bmcfeecommented, Jan 16, 2020

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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Librosa: Cannot provide window function for mfcc on Windows
The paper's authors used a Hamming window in the MFCC calculation and I tried to provide the function as additional parameter in the ......
Read more >
What is the advantage of applying a Hamming window for ...
I am trying to implement MFCC by following this and I found that there is a step in which signals are divided into...
Read more >
Hamming Window - an overview | ScienceDirect Topics
Here h(n) is a Hamming window of N size, and K is the DFT length. ... We can design a digital filter to...
Read more >
Speech Recognition — Feature Extraction MFCC & PLP
It provides no value in speech recognition and should be removed. ... A few alternatives for w are the Hamming window and the...
Read more >
Librosa: Cannot Provide Window Function For Mfcc ... - ADocLib
This paper presents the feasibility of MFCC to extract features and DTW to Hamming window is used as window shape by considering the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found