Python synthesizes midi with fluids

I can not import Fluidsynth. [Maybe there is a better module?]

I am trying to synthesize midi from python or pygame. I can send midi events from pygame. I use mingus and it seemed that pyfluidsynth would be good / easy.

I think that means pyfluidsynth is installed, but there was no separate fluidsynth. I do not know if the fluidsynth installer is required for operation?

test.py:

import fluidsynth print ":(" 

Error:

 Traceback (most recent call last): File "test.py", line 1, in <module> import fluidsynth File "C:\Users\jake\AppData\Roaming\Python\Python27\site-packages\fluidsynth.py", line 34, in <module> raise ImportError, "Couldn't find the FluidSynth library." ImportError: Couldn't find the FluidSynth library. 

using: python 2.7-win32

+6
source share
3 answers

The python fluidsynth module searches for the FluidSynth binary library file (e.g. fluidsynth.dll).

To do this, you can download, compile and install http://sourceforge.net/projects/fluidsynth/files/fluidsynth-1.1.3/

OR

you can find projects using fluidsynth (i.e. QSynth) that include precompiled copies of the .dll file.

+3
source

Yes, you also need the FuildSynth library (dll for windows).

So that he works with:

  • synthsynth liquid 1.1.6
  • python26 (32bits)
  • pyFluidSynth 1.1.4
  • for windows

I placed everything in one directory (flidsynth dll, PyFluidSynth module, python script).

and modifies the following lines in pyFluidSynth modules (from line 30):

 # A short circuited or expression to find the FluidSynth library # (mostly needed for Windows distributions of libfluidsynth supplied with QSynth) # and Dynamically link the FluidSynth library lib = find_library('fluidsynth') or find_library('libfluidsynth') or find_library('libfluidsynth-1') if lib is None: _fl = ctypes.cdll.LoadLibrary("./libfluidsynth") lib = "ok"; else: _fl = CDLL(lib) if lib is None: raise ImportError, "Couldn't find the FluidSynth library." # Helper function for declaring function prototypes 

It works great with this setting.

+3
source

Looking at fluidsynth.py , your guess is probably correct. You should try to place fluidsynth.dll somewhere in the search path of your system library (the simplest will probably be the same directory as your script or fluidsynth.py ).

I think this archive (found through google) contains the desired win32 binary: http://svn.drdteam.org/zdoom/fluidsynth.7z

0
source

Source: https://habr.com/ru/post/886659/


All Articles