读取wav文件时出现运行时错误

4
我正在遵循https://github.com/mravanelli/SincNet库。我按照建议遵循了文档,但是出现了运行错误。
我已经使用sudo chmod +x /home/sathiyakugan/Downloads/TIMIT/data/lisa/data/timit/raw/TIMIT更改了文件访问权限,但这没有解决问题。
这是我执行的语法:python3 TIMIT_preparation.py /home/sathiyakugan/Downloads/TIMIT/data/lisa/data/timit/raw/TIMIT /home/sathiyakugan/Documents/FYP/out data_lists/TIMIT_all.scp 这是我收到的错误。
  File "TIMIT_preparation.py", line 56, in <module>
    [signal, fs] = sf.read(wav_file)
  File "/home/sathiyakugan/.local/lib/python3.6/site-packages/soundfile.py", line 257, in read
    subtype, endian, format, closefd) as f:
  File "/home/sathiyakugan/.local/lib/python3.6/site-packages/soundfile.py", line 627, in __init__
    self._file = self._open(file, mode_int, closefd)
  File "/home/sathiyakugan/.local/lib/python3.6/site-packages/soundfile.py", line 1182, in _open
    "Error opening {0!r}: ".format(self.name))
  File "/home/sathiyakugan/.local/lib/python3.6/site-packages/soundfile.py", line 1355, in _error_check
    raise RuntimeError(prefix + _ffi.string(err_str).decode('utf-8', 'replace'))
RuntimeError: Error opening '/home/sathiyakugan/Downloads/TIMIT/data/lisa/data/timit/raw/TIMIT/train/dr1/fvmh0/si1466.wav': System error.

1
相关:https://github.com/bastibe/SoundFile/issues/227? - Caramiriel
请仔细检查路径。在我的情况下,这也是一个问题。 - Aidos
1个回答

0

如果出现权限问题或者打字错误,请仔细检查路径。SoundFile模块打开的文件并不是相对于当前目录的,而是需要该文件的绝对路径。


1
谢谢您的回答,您能展示一些您所说的例子吗? - William Baker Morrison
@WilliamBakerMorrison,您是指您不理解“使用绝对路径”吗?请参考“./”和“~/”之间的区别(标题涉及更具体的问题,但我发布了一个回答,试图解释更广泛的情况)。 - tripleee

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接