如何解决声音设备库错误
所以我一直在尝试一个涉及音频的项目,到目前为止,我尝试过的每个库都以一种或另一种方式损坏了,我认为最后的选择可能是Sound Device,因为它似乎还具有其他一些有趣的属性我想尝试一下。我基本上是复制粘贴了他们在其网站上提供的示例代码,并提出了一系列错误清单。我的代码非常简单,我添加的只是一个Input命令,以确保在这种情况下能够发出声音。如果还有其他库可能起作用,或者只是一个愚蠢的错误,那么任何帮助都将是惊人的,谢谢!!
import sounddevice as sd
import soundfile as sf
fileC = 'PianoC.wav'
UI = input("Press C")
if UI == "c":
data,fs = sf.read(fileC,dtype ='float32')
sd.play(data,fs)
Status = sd.wait
Traceback (most recent call last):
File "C:\Users\**\AppData\Local\Programs\Python\Python38\key.py",line 7,in <module>
data,dtype ='float32')
File "C:\Users\**\AppData\Local\Programs\Python\Python38\lib\site-packages\soundfile.py",line 256,in read
with SoundFile(file,'r',samplerate,channels,File "C:\Users\**\AppData\Local\Programs\Python\Python38\lib\site-packages\soundfile.py",line 629,in __init__
self._file = self._open(file,mode_int,closefd)
File "C:\Users\**\AppData\Local\Programs\Python\Python38\lib\site-packages\soundfile.py",line 1183,in _open
_error_check(_snd.sf_error(file_ptr),line 1357,in _error_check
raise RuntimeError(prefix + _ffi.string(err_str).decode('utf-8','replace'))
RuntimeError: Error opening 'PianoC.wav': System error.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。