添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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

Already on GitHub? Sign in to your account

path = 'D:/fma_small/000/000002.mp3'

path = os.fspath(path)

y, sr = librosa.load(path, duration=10)

ps = librosa.feature.melspectrogram(y=y, sr=sr, n_mels=128)

ps.shape

Expected Results

Just the shape i.e. (128, 431)

Actual Results

RuntimeError Traceback (most recent call last)
c:\python37\lib\site-packages\librosa\core\audio.py in load(path, sr, mono, offset, duration, dtype, res_type)
128 try:
--> 129 with sf.SoundFile(path) as sf_desc:
130 sr_native = sf_desc.samplerate

c:\python37\lib\site-packages\soundfile.py in init (self, file, mode, samplerate, channels, subtype, endian, format, closefd)
628 format, subtype, endian)
--> 629 self._file = self._open(file, mode_int, closefd)
630 if set(mode).issuperset('r+') and self.seekable():

c:\python37\lib\site-packages\soundfile.py in _open(self, file, mode_int, closefd)
1183 _error_check(_snd.sf_error(file_ptr),
-> 1184 "Error opening {0!r}: ".format(self.name))
1185 if mode_int == _snd.SFM_WRITE:

c:\python37\lib\site-packages\soundfile.py in _error_check(err, prefix)
1356 err_str = _snd.sf_error_number(err)
-> 1357 raise RuntimeError(prefix + _ffi.string(err_str).decode('utf-8', 'replace'))

RuntimeError: Error opening 'D:/fma_small/000/000002.mp3': File contains data in an unknown format.

During handling of the above exception, another exception occurred:

NoBackendError Traceback (most recent call last)
----> 1 y, sr = librosa.load(path, duration=10)
2 ps = librosa.feature.melspectrogram(y=y, sr=sr, n_mels=128)
3 ps.shape

c:\python37\lib\site-packages\librosa\core\audio.py in load(path, sr, mono, offset, duration, dtype, res_type)
145 if sys.version_info >= (3, 4):
146 import pathlib
--> 147
148 # check if a Path object is passed by the user
149 if isinstance(path, pathlib.PurePath):

c:\python37\lib\site-packages\librosa\core\audio.py in __audioread_load(path, offset, duration, dtype)
170 if sr is not None:
--> 171 y = resample(y, sr_native, sr, res_type=res_type)
173 else:

c:\python37\lib\site-packages\audioread_ init _.py in audio_open(path, backends)
115 # All backends failed!
--> 116 raise NoBackendError()

NoBackendError:

Versions