python synthesize midi with fluidsynth

ninMonkey picture ninMonkey · Apr 26, 2011 · Viewed 7.3k times · Source

I can't import fluidsynth. [Maybe there's an better module?]

I'm trying to synthesize midi from python or pygame. I can send midi events from pygame. I'm using mingus, and it seemed pyfluidsynth would be good / easiest.

I think this means pyfluidsynth is installed, but a seperate fluidsynth was not. I don't know if it requires a 'fluidsynth' installer to work?

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

Answer

Hugh Bothwell picture Hugh Bothwell · Apr 26, 2011

The python fluidsynth module is looking for the FluidSynth binary library file (ie fluidsynth.dll).

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

OR

you may be able to find projects using fluidsynth (ie QSynth) which include precompiled copies of the .dll file.