FileNot FoundError:fluidsynth

时间:2018-03-30 03:35:47

标签: python-3.x

我只想使用midi2audio将我的midi文件转换为mp3,我使用此代码:

----------
from midi2audio import FluidSynth

FluidSynth().midi_to_audio('test.mid','test.mp3')


---------- or

from midi2audio import FluidSynth

FluidSynth().play_midi('test.mid')

但我得到了同样的结果:

----------


/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 /Users/blake/Desktop/Bsmart_music/test/t_p/1.py
Traceback (most recent call last):
  File "/Users/blake/Desktop/Bsmart_music/test/t_p/1.py", line 5, in <module>
    FluidSynth().play_midi('test.mid')
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/midi2audio.py", line 49, in play_midi
    subprocess.call(['fluidsynth', '-i', self.sound_font, midi_file, '-r', str(self.sample_rate)])
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 267, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 1344, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'fluidsynth': 'fluidsynth'

Process finished with exit code 1


----------

所以,我试着复制折叠&#34; fluidynth&#34;到&#34; midi2audio&#34;,但它仍然无法运作。我已经安装了midi2audio和fluidsynth,谁知道发生了什么?

2 个答案:

答案 0 :(得分:1)

您必须在PATH环境变量指向的某个文件夹中复制“fluidsynth” (在终端应用中键入“echo $ PATH”以查看实际注册的内容)。

在类似unix的系统上,python通常会找到位于/ usr / bin / fluidsynth的fluidynth(因为/ usr / bin在PATH中列出)。在Os X上,任何文档都应该适合的东西并没有太大的不同。通常的做法是使用/ usr / local / bin文件夹添加自定义程序。

答案 1 :(得分:0)

也许您应该先安装Fluidsynth

对于Ubuntu:

sudo apt-get install fluidsynth