2011-04-25 36 views
6

Tôi không thể nhập chất lỏng. [Có thể có mô-đun tốt hơn?]python tổng hợp midi với fluidsynth

Tôi đang cố gắng tổng hợp midi từ python hoặc pygame. Tôi có thể gửi các sự kiện midi từ pygame. Tôi đang sử dụng mingus, và dường như pyfluidsynth sẽ là tốt/dễ nhất.

Tôi nghĩ rằng điều này có nghĩa là pyfluidsynth được cài đặt, nhưng một fluidsynth riêng biệt thì không. Tôi không biết liệu nó có yêu cầu một trình cài đặt 'fluidsynth' hoạt động không?

test.py:

import fluidsynth 
print ":(" 

lỗi:

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. 

sử dụng: python 2.7-win32

+0

bạn đã thử https://github.com/MostAwesomeDude/pyfluidsynth? – endolith

Trả lời

0

Nhìn vào fluidsynth.py, đoán của bạn có lẽ là đúng. Bạn nên thử đặt fluidsynth.dll ở đâu đó trong đường dẫn tìm kiếm trong thư viện của hệ thống của bạn (thư mục có thể dễ dàng nhất giống với tập lệnh của bạn hoặc fluidsynth.py).

Tôi nghĩ rằng lưu trữ này (tìm thấy qua google) chứa win32 nhị phân cần thiết: http://svn.drdteam.org/zdoom/fluidsynth.7z

3

Module fluidsynth trăn đang tìm kiếm các tập tin thư viện FluidSynth nhị phân (tức là fluidsynth.dll).

Để có được điều này bạn có thể tải về, biên dịch và cài đặt http://sourceforge.net/projects/fluidsynth/files/fluidsynth-1.1.3/

HOẶC

bạn có thể tìm thấy dự án sử dụng fluidsynth (tức QSynth) trong đó bao gồm bản sao biên dịch sẵn của file .dll.

3

Có, bạn cũng cần lib của FuildSynth (dll cho cửa sổ).

Để làm cho nó hoạt động với:

  • chất lỏng synthsynth 1.1.6
  • python26 (32bits)
  • pyFluidSynth 1.1.4
  • của Windows

Tôi đã đặt Everythings trong cùng một thư mục (fluidsynth dll, PyFluidSynth Module, python script).

và thay đổi dòng sau trong module pyFluidSynth (từ dòng 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 

Nó hoạt động tốt với thiết lập này.

Các vấn đề liên quan