简体   繁体   English

无法让 librosa 加载 wav 文件

[英]Can't get librosa load a wav file

I got an audio dataset of many wav files and tired to use librosa to edit, but I have trouble reading some certain files by using librosa.load.Could someone help me figure it out?我得到了许多 wav 文件的音频数据集,并且厌倦了使用 librosa 进行编辑,但是我在使用 librosa.load 读取某些文件时遇到了麻烦。有人可以帮我弄清楚吗?

here is my code:这是我的代码:

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

here is the error:这是错误:

---------------------------------------------------------------------------
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'

The failing line is:失败的线路是:

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

AttributeError: 'module' object has no attribute 'MadFile' AttributeError: 'module' 对象没有属性 'MadFile'

This looks to be a problem with the pyMad library .这看起来是pyMad 库的问题。 Would suggest looking into upgrading or reinstalling.建议考虑升级或重新安装。 that library.那个图书馆。 If that fails you might want to raise a bug .如果失败,您可能想提出一个错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM