4

I have installed fluidsynth version 2.0.5 and am using it in mingus. However, when i ran the code

from mingus.midi import fluidsynth

It return this

Traceback (most recent call last):
  File "/Users/rudiherrig 1 2/Desktop/pythonstuff/musicExp.py", line 1, in <module>
    from mingus.midi import fluidsynth
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mingus/midi/fluidsynth.py", line 37, in <module>
    from mingus.midi import pyfluidsynth as fs
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mingus/midi/pyfluidsynth.py", line 41, in <module>
    raise ImportError("Couldn't find the FluidSynth library.")
ImportError: Couldn't find the FluidSynth library.

I find this quite confusing as i have fluidsynth installed. Any ideas on how to fix this? Edit: I found a file called fluidsynth_dll.dsp in my library so i dont know why it is returning this error.

Marc K
  • 261
  • 3
  • 8
  • 23
Rudi Herrig
  • 103
  • 1
  • 7
  • Have you found a solution for this? I am also facing this problem. – emil May 11 '21 at 10:02
  • I fixed this by saving the libfluidsynth-3.dll and its dependencies (a bunch of other .dlls) into the same directory as the fluidsynth.exe (this is the install path per cmd). – Logan Price Mar 14 '23 at 02:10

2 Answers2

3

I met with the same problem and resolved in the following way:

  1. I have Mac system with M1 chip, Ventura OS. I homebrewed fluidsynth. As a result, the find_library only couldn't find the library in homebrew dictionary.

  2. Find the path of fluidsynth. In terminal, run brew --prefix fluidsynth
    My result is /opt/homebrew/opt/fluid-synth
    The path of fluidsynth then would be /opt/homebrew/opt/fluid-synth/lib/libfluidsynth.dylib


  1. Add that path to python file.
    When you get the error message, it guides you to the path of the error-raised py, such as
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mingus/midi/pyfluidsynth.py", line 41, in <module> raise ImportError("Couldn't find the FluidSynth library.")

    In the Finder, Go - Go to folder.., and go to the path, then open the file.

    In the editor, find the lines
lib = (
    find_library("fluidsynth")
    or find_library("libfluidsynth")
    or find_library("libfluidsynth-1")
)
  1. After that line, add a new line lib = '...path...' with the path from step 1.

This will solve this error.

Dayou Wang
  • 31
  • 3
1

You need to install libfluidsynth.dll

  1. Download precompiled DLL from: https://zdoom.org/downloads#Support
  2. If you use 64x version rename file from libfluidsynth64.dll to libfluidsynth.dll
  3. Place it into C:\Windows\System32

You can also compile it by yourself using GitHub project