Installing pyfluidsynth on windows

喜夏-厌秋 提交于 2019-12-11 06:08:01

问题


I'm trying to install pyfluidsynth on windows. I used pip install pyfluidsynth in the command prompt, but when I tried to import fluidsynth in my python code I get:

 ModuleNotFoundError: No module named 'FluidSynth'

When I tried to install FluidSynth (by using pip install fluidsynth) another binding package was install with FluidSynth 0.2 from several years ago.

Can anybody help with specific details how to install pyfluidsynth on windows and use it?

import FluidSynth

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\Program Files\JetBrains\PyCharm 2018.3.2\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
ModuleNotFoundError: No module named 'FluidSynth'

回答1:


For recent FluidSynth versions there do not seem to be pre-built binaries for ms-windows available. (Note that development is now done on github; the sourceforge site is stale.) The latest source code releases are here.

But the FluidSynth wiki has instructions for building it on ms-windows.

Note: FluidSynth (more precisely, its shared library) is a requirement for using pyfluidsynth. See the README.




回答2:


For me the following worked:

  1. Go to the following link and download the pre-compiled (?) fluidsynth dll.
  2. Add the directory of your fluidsynth dll to the path environment variable.
  3. In the pyfluidsynth package. find the "fluidsynth.py" file, and edit the part where it's looking for the library "lib = find_library('fluidsynth')..." to search for the dll name, which was "libfluidsynth64" for the 64 bit version.
  4. For whatever reason, (maybe version mismatch), the functions "fluid_synth_set_reverb_full" and "fluid_synth_set_chorus_full" are not supported, so comment those lines out from "fluidsynth.py".
  5. And that's it. Save "fluidsynth.py" launch cmd, go into python, and import fluidsynth.

I haven't tested all the functionality of fluidsynth, but using pretty_midi, I was able to at least play midi through instrument soundfonts.

Hope this helps!



来源:https://stackoverflow.com/questions/54166861/installing-pyfluidsynth-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!