1

我得到了许多 wav 文件的音频数据集,并且厌倦了使用 librosa 进行编辑,但是我无法使用 librosa.load 读取某些文件。有人可以帮我弄清楚吗?

这是我的代码:

import librosa
sound_clip = librosa.load('audio/fold1/180937-7-3-10.wav')
print(sound_clip)

这是错误:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-5-93fe2f032e98> in <module>()
----> 1 sound_clip = librosa.load('audio/fold1/180937-7-3-10.wav')
      2 print(sound_clip)

/home/uri7910/anaconda2/envs/tensorflow011/lib/python2.7/site-packages/librosa/core/audio.pyc in load(path, sr, mono, offset, duration, dtype)
    107 
    108     y = []
--> 109     with audioread.audio_open(os.path.realpath(path)) as input_file:
    110         sr_native = input_file.samplerate
    111         n_channels = input_file.channels

/home/uri7910/anaconda2/envs/tensorflow011/lib/python2.7/site-packages/audioread/__init__.pyc in audio_open(path)
    100         from . import maddec
    101         try:
--> 102             return maddec.MadAudioFile(path)
    103         except DecodeError:
    104             pass

/home/uri7910/anaconda2/envs/tensorflow011/lib/python2.7/site-packages/audioread/maddec.pyc in __init__(self, filename)
     24     def __init__(self, filename):
     25         self.fp = open(filename, 'rb')
---> 26         self.mf = mad.MadFile(self.fp)
     27         if not self.mf.total_time(): # Indicates a failed open.
     28             raise UnsupportedError()

AttributeError: 'module' object has no attribute 'MadFile'
4

1 回答 1

0

失败的路线是:

self.mf = mad.MadFile(self.fp)

AttributeError:“模块”对象没有属性“MadFile”

这看起来是pyMad 库的问题。建议考虑升级或重新安装。那个图书馆。如果失败了,你可能想提出一个错误

于 2017-01-25T16:36:11.700 回答