我试图让 pydub 将 2 个音频 wav 文件混合成一个 wav 文件。这是我当前的代码:
from pydub import AudioSegment
sound1 = AudioSegment.from_wav("Test_1.wav")
sound2 = AudioSegment.from_wav("Test_2.wav")
# mix sound2 with sound1, starting at 5000ms into sound1)
output = sound1.overlay(sound2, position=5000)
# save the result
output.export("mixed.wav", format="wav")
这是确切的错误日志:
Traceback (most recent call last):
File "heterodyning.py", line 10, in <module>
output.export("mixed.wav", format = "wav")
File "build/bdist.linux-armv6l/egg/pydub/audio_segment.py", line 234, in export
File "/usr/lib/python2.7/subprocess.py", line 493, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1259, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
但是,无论出于何种原因,每当我尝试运行它时,它都会引发 raise_child 异常,并告诉我没有这样的文件或目录,指的是我告诉它导出的最后一行。我不知道为什么。谁能告诉我为什么会这样?