'pyFluidsynth 'module' object has no attribute 'Synth'

I have both fluidsynth

sudo apt-get install fluidsynth

and pyfluidsynth

sudo pip install pyfluidsynth

installed.

However, when I run the standard import commands, I get the following error:

>>> import fluidsynth
>>> fs = fluidsynth.Synth()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'Synth'


Solution 1:[1]

I also had this problem with fluidsynth installation. I followed the following steps in Windows:

  • Install pyfluidsynth: pip install git+https://github.com/0xf0f/pyfluidsynth
  • Go to the path where fluidsynth has been installed: Ex.: C:\ProgramData\Anaconda3\Lib\site-packages and open fluidsynth.py file.
  • In the line of fluidsynth.py where it is written lib = find_library('fluidsynth') add find_library('libfluidsynth64')
  • Now download libfluidsynth64.dll and paste it in the path where you have fluidsynth installed: Ex.: C:\ProgramData\Anaconda3\Lib\site-packages

You can test if it works by running python, import fluidsynth and fuidsynth.Synth() in the Anaconda Prompt.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Carlos Hernández Oliván