gpt4 book ai didi

python - 无法让librosa加载WAV文件

转载 作者:行者123 更新时间:2023-12-02 23:38:42 25 4
gpt4 key购买 nike

我得到了很多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'

最佳答案

失败的行是:

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

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



这似乎是 pyMad library的问题。建议您考虑升级或重新安装。该图书馆。如果失败,则可能需要 raise a bug

关于python - 无法让librosa加载WAV文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41842419/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com