“No Backend Error” while reading files in Python

最后都变了- 提交于 2020-02-07 05:30:44

问题


I am trying to perform STFT on a bunch of sound files and I get this error. The path of the files which I am trying to perform STFT is correct but still, I get this error.

import librosa
import io
import numpy as np
import tensorflow as tf
import os
import glob


path_te = "C:\Users\aanum\OneDrive\Documents\Deep Learning\timit-homework\te"
files = os.listdir(path_te)
for file in sorted(files):
    if file.startswith("tex"):

        file_path = path_te2 + "/" + file 

        #file_path = 'r' + "'" + str(file_path) + "'"
        print(file_path)
        st, sr=librosa.load(file_path, sr=None)

Output:

C:/Users/aanum/OneDrive/Documents/Deep Learning/timit-homework/te/tex0000.wav
---------------------------------------------------------------------------
NoBackendError                            Traceback (most recent call last)
<ipython-input-54-4df25548d204> in <module>
      7         #file_path = 'r' + "'" + str(file_path) + "'"
      8         print(file_path)
----> 9         st, sr=librosa.load(file_path, sr=None)
     10         X=librosa.stft(st, n_fft=1024, hop_length=512)
     11         X_abs = abs(X)

~\Anaconda3\envs\DeepLearning\lib\site-packages\librosa\core\audio.py in load(path, sr, mono, offset, duration, dtype, res_type)
    117 
    118     y = []
--> 119     with audioread.audio_open(os.path.realpath(path)) as input_file:
    120         sr_native = input_file.samplerate
    121         n_channels = input_file.channels

~\Anaconda3\envs\DeepLearning\lib\site-packages\audioread\__init__.py in audio_open(path, backends)
    114 
    115     # All backends failed!
--> 116     raise NoBackendError()

NoBackendError

Can anyone tell me why I have this error?

来源:https://stackoverflow.com/questions/58810320/no-backend-error-while-reading-files-in-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!