melspectrogram() error
tony2023 opened this issue ยท 7 comments
On ubuntu 22.04
when I run the demo_cli.py, I got this:
melspectrogram() takes 0 positional arguments but 2 positional arguments.
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
Can confirm that this works
Yes, it works fine for me. I think this issue is for the new release of Librosa. Librosa wants parameters with names.
@tony2023 I've got almost the same issue at Windows, conda version change of librosa fixed this, but demo_toolbox.py still not running...
use librosa vesrion 0.9.2 the issue will be sorted
Thanks to ajay-sampath
It works with librosa 0.9.2
Command: pip install librosa==0.9.2
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