I am trying to use FluidSynth in a game that I'm working on, but I can't seem to get Fluidsynth to work properly. Whenever I try to import I get this:
>>> import fluidsynth
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python26\lib\site-packages\fluidsynth.py", line 35, in <module>
_fl = ctypes.cdll.LoadLibrary("./libfluidsynth")
NameError: name 'ctypes' is not defined
I read that you can do some import command to get rid of the Ctypes error but when I try that this happens:
>>> lib = ctypes.WinDLL('C:\Python26\Lib\site-packages\libfluidsynth.dll')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python26\lib\ctypes\__init__.py", line 353, in __init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 193] %1 is not a valid Win32 application
I'm aware that the win32 application error usually happens when you're trying to run an app that's not designed for the computer's processor, but the source I downloaded the libfluidsynth.dll from said it was for Windows 32.
I am using Windows 7 64 bit, and Python 2.6.
Also, I downloaded Python on my 32-bit computer, and also the pyFluidSynth package and the FluidSynth DLL itself, however it was telling me it couldn't find the FluidSynth library or something.
When loading libraries, the library you're loading much match the architecture of the Python you are currently running.
Ensure that if your Python is 64-bit, that
libfluidsynth.dll
is 64-bit. Same with 32-bit. They must be the same.You can identify whether your Python in 64-bit or 32-bit with this code: