gpt4 book ai didi

python - WinError 2:系统找不到在Python中用FluidSynth指定的文件吗?

转载 作者:行者123 更新时间:2023-12-03 01:24:11 28 4
gpt4 key购买 nike

试图使程序将MIDI文件转换为其他文件类型。
这是无效的代码示例:

from midi2audio import FluidSynth
midfile = "F:\\ai nea\\Actual Project\\"+input()
output = "F:\\ai nea\\Actual Project\\output.mp3"
soundfont= "F:\\ai nea\\Actual Project\\FluidR3 GM.sf2"
fs = FluidSynth(sound_font=soundfont)
fs.midi_to_audio(midfile,output)

这是一个异常(exception):
Traceback (most recent call last):
File "F:/ai nea/Actual Project/contest.py", line 6, in <module>
fs.midi_to_audio(midfile,output)
File "C:\Users\Will\AppData\Local\Programs\Python\Python37\lib\site-packages\midi2audio.py", line 46, in midi_to_audio
subprocess.call(['fluidsynth', '-ni', self.sound_font, midi_file, '-F', audio_file, '-r', str(self.sample_rate)])
File "C:\Users\Will\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 339, in call
with Popen(*popenargs, **kwargs) as p:
File "C:\Users\Will\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 800, in __init__
restore_signals, start_new_session)
File "C:\Users\Will\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 1207, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

有任何想法吗?

最佳答案

找不到您的程序“fluidsynth.exe”。您可以解决此问题,将程序的位置放在PATH环境变量中。

关于python - WinError 2:系统找不到在Python中用FluidSynth指定的文件吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60466776/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com