我正在使用Pydub来获取音频文件,并根据存储在数据帧中的时间将其归档。我要切片的代码如下:
def wav_slice(infile, outfilename, start_ms, end_ms):
"""
This piece of code performs the slicing of the wave file
according to the time values that are returned back
by the Cobalt engine.
"""
input = AudioSegment.from_file(location)
print(input)
reqd_part = input[start_ms:end_ms]
reqd_part.export(outfilename, format="wav")
数据导入正常。当我尝试写出数据时,我不断收到此错误:
[Errno 2] No such file or directory: '/Users/my_name/Desktop/blue_canoe/training_data_trimmed/l_sound/1494932479912.wav'
代码的重点是创建文件并将数据写入其中。我已经尝试调试了大约一天,现在仍然很幸运。任何想法为什么会这样?