Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

melspectrogram() error #1176

Open
tony2023 opened this issue Mar 18, 2023 · 7 comments
Open

melspectrogram() error #1176

tony2023 opened this issue Mar 18, 2023 · 7 comments

Comments

@tony2023
Copy link

On ubuntu 22.04
when I run the demo_cli.py, I got this:

melspectrogram() takes 0 positional arguments but 2 positional arguments.

@eminser
Copy link

eminser commented Mar 22, 2023

Change the relevant function like this:

def wav_to_mel_spectrogram(wav):
"""
Derives a mel spectrogram ready to be used by the encoder from a preprocessed audio waveform.
Note: this not a log-mel spectrogram.
"""
frames = librosa.feature.melspectrogram(
y=wav, # changed row
sr=sampling_rate, # changed row
n_fft=int(sampling_rate * mel_window_length / 1000),
hop_length=int(sampling_rate * mel_window_step / 1000),
n_mels=mel_n_channels
)
return frames.astype(np.float32).T

@LucasCoraca
Copy link

Can confirm that this works

@eminser
Copy link

eminser commented Apr 5, 2023

Yes, it works fine for me. I think this issue is for the new release of Librosa. Librosa wants parameters with names.

@OrelSokolov
Copy link

OrelSokolov commented Apr 6, 2023

@tony2023 I've got almost the same issue at Windows, conda version change of librosa fixed this, but demo_toolbox.py still not running...

@ajay-sampath
Copy link

use librosa vesrion 0.9.2 the issue will be sorted

@philfranc
Copy link

Thanks to ajay-sampath
It works with librosa 0.9.2
Command: pip install librosa==0.9.2

@matcarpes
Copy link

Thanks for the tip!
I had the following error with the melspectrogram function:

TypeError: melspectrogram() takes 0 positional arguments but 1 positional argument (and 1 keyword-only argument) were given

Installing librosa 0.9.2 fixed it

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants