python中文件读取失败_python-3.6

我正在尝试对一堆声音文件执行STFT,但出现此错误。 我试图执行STFT的文件路径正确,但是仍然出现此错误。

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)

输出:

C:/Users/aanum/OneDrive/Documents/Deep Learning/timit-homework/te/tex0000.wav

---------------------------------------------------------------------------

NoBackendError Traceback (most recent call last)

in

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

谁能告诉我为什么有这个错误?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值