7

fluidsynth をインポートできません。【もっといいモジュールはないかな?】

Python または pygame から midi を合成しようとしています。pygame から MIDI イベントを送信できます。私はmingusを使用していますが、pyfluidsynthが良い/最も簡単だと思われました。

これはpyfluidsynthがインストールされていることを意味すると思いますが、別のfluidsynthはインストールされていません。「fluidsynth」インストーラーが必要かどうかわかりません。

test.py:

import fluidsynth
print ":("

エラー:

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.

使用: python 2.7-win32

4

3 に答える 3

3

python fluidsynth モジュールは、FluidSynth バイナリ ライブラリ ファイル (つまり fluidsynth.dll) を探しています。

これを取得するには、http: //sourceforge.net/projects/fluidsynth/files/fluidsynth-1.1.3/ をダウンロード、コンパイル、インストールします。

また

.dll ファイルのコンパイル済みコピーを含む fluidsynth (QSynth) を使用するプロジェクトを見つけることができる場合があります。

于 2011-04-25T22:48:46.610 に答える
3

はい、FuildSynth ライブラリも必要です (Windows 用の dll)。

それを動作させるには:

  • 流体シンセシンセ 1.1.6
  • python26 (32ビット)
  • pyFluidSynth 1.1.4
  • ウィンドウズ

すべてを同じディレクトリに配置しました(fluidsynth dll、PyFluidSynthモジュール、pythonスクリプト)。

pyFluidSynth モジュールの次の行 (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

この設定で問題なく動作します。

于 2013-05-22T12:20:18.330 に答える
0

を見てfluidsynth.py、あなたの推測はおそらく正しいです。システムのライブラリ検索パスのどこかに配置してみてfluidsynth.dllください(最も簡単なのは、スクリプトまたはと同じディレクトリfluidsynth.pyです)。

このアーカイブ(グーグル経由で見つかりました)には、必要なwin32バイナリが含まれていると思います:http ://svn.drdteam.org/zdoom/fluidsynth.7z

于 2011-04-25T22:46:25.917 に答える