fix(standalone): bundle pedalboard.midi_utils + pyfluidsynth dll path

- engine.spec hiddenimports: pedalboard.midi_utils (C++ ExternalPlugin.h
  import dong, PyInstaller khong phat hien duoc -> midi-render 500)
- engine.spec hiddenimports: fluidsynth (pyfluidsynth cffi) cho
  /soundfont-render native
- vst_engine.py: _ensure_fluidsynth_dll_on_path() - frozen app them
  exe_dir vao PATH de ctypes.util.find_library tim thay
  libfluidsynth-3.dll dat ke exe
This commit is contained in:
2026-08-16 18:50:27 +07:00
parent 1d40cf27b7
commit 781425588c
2 changed files with 24 additions and 0 deletions
+16
View File
@@ -5,6 +5,22 @@ import numpy as np
import functools
from ctypes import c_char_p
def _ensure_fluidsynth_dll_on_path():
"""Frozen (PyInstaller): pyfluidsynth tim dll qua ctypes.util.find_library
(chi quet PATH). Dat libfluidsynth-3.dll ke exe roi them exe_dir vao PATH
truoc khi import fluidsynth - nguoc lai: 'Couldn't find the FluidSynth
library' -> /soundfont-render tra 501."""
import sys
if getattr(sys, 'frozen', False):
exe_dir = os.path.dirname(os.path.abspath(sys.executable))
if exe_dir and exe_dir not in os.environ.get('PATH', '').split(os.pathsep):
os.environ['PATH'] = exe_dir + os.pathsep + os.environ.get('PATH', '')
_ensure_fluidsynth_dll_on_path()
def midi_note_to_freq(note_number: int) -> float:
return 440.0 * (2.0 ** ((note_number - 69) / 12.0))
+8
View File
@@ -90,8 +90,16 @@ _hidden = [
'uvicorn.protocols.websockets',
'uvicorn.protocols.websockets.auto',
'pedalboard',
# C++ ExternalPlugin.h import pedalboard.midi_utils khi tao VST3Plugin
# (py::module_::import) - PyInstaller khong thay duoc import tu C++, phai
# khai bao hiddenimport thu cong (thieu -> "No module named
# 'pedalboard.midi_utils'" khi /midi-render).
'pedalboard.midi_utils',
'soundfile',
'sf2utils',
# pyfluidsynth (fluidsynth.py cffi) - render soundfont native cho
# /soundfont-render (browser client). Can libfluidsynth-3.dll ke exe.
'fluidsynth',
'mido.backends.rtmidi',
] + _scipy_signal_hidden