Closed tingtron closed 3 years ago
Oh. That explains why pyfluidsynth doesn't find them in issue #11. Did you fix the problem on windows? I could test it on linux and push it to PyPI if it works.
On Thu, 25 Oct 2018 at 23:25, Ting Tron notifications@github.com wrote:
Looks like pyfluidsynth uses internal functions:
- fluid_synth_set_reverb_full
- fluid_synth_set_chorus_full
They are only used in the internal sources of fluidsynth and are not exported. They are also not present in the include directory for header files. Tested on Windows. Note: as is, it might work on Linux/Mac, but not on Windows.
Suggested is to use the "public" api, which is properly exported in the DLL,
FLUIDSYNTH_API int fluid_synth_set_reverb(fluid_synth_t synth, double roomsize, double damping, double width, double level); FLUIDSYNTH_API int fluid_synth_set_reverb_roomsize(fluid_synth_t synth, double roomsize); FLUIDSYNTH_API int fluid_synth_set_reverb_damp(fluid_synth_t synth, double damping); FLUIDSYNTH_API int fluid_synth_set_reverb_width(fluid_synth_t synth, double width); FLUIDSYNTH_API int fluid_synth_set_reverb_level(fluid_synth_t *synth, double level);
Full error output:
python test1.py Traceback (most recent call last): File "test1.py", line 2, in
import fluidsynth File "c:\Tools\Python27\lib\site-packages\fluidsynth.py", line 188, in ('level', c_double, 1)) File "c:\Tools\Python27\lib\site-packages\fluidsynth.py", line 53, in cfunc return CFUNCTYPE(result, *atypes)((name, _fl), tuple(aflags)) AttributeError: function 'fluid_synth_set_reverb_full' not found — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nwhitehead/pyfluidsynth/issues/12, or mute the thread https://github.com/notifications/unsubscribe-auth/AYlAVqTUEh7Bgl9nWgvRxyfWCYeAkuLbks5uoixhgaJpZM4X7JCT .
There are a number of changes I had to make to fluidsynth.py
to make it work:
(dsound
/ pulseaudio
are unrelated)
c:\Tools\Python27\Lib\site-packages>diff fluidsynth.py fluidsynth1.py
182c182
< fluid_synth_set_reverb = cfunc('fluid_synth_set_reverb', c_int,
---
> fluid_synth_set_reverb_full = cfunc('fluid_synth_set_reverb_full', c_int,
183a184
> ('set', c_int, 1),
189c190
< fluid_synth_set_chorus = cfunc('fluid_synth_set_chorus', c_int,
---
> fluid_synth_set_chorus_full = cfunc('fluid_synth_set_chorus_full', c_int,
190a192
> ('set', c_int, 1),
392c394
< return numpy.fromstring(buf[:], dtype=numpy.int16)
---
> return numpy.frombuffer(buf[:], dtype=numpy.int16)
439c441
< 'sndmgr', 'coreaudio', 'Direct Sound', 'dsound'
---
> 'sndmgr', 'coreaudio', 'Direct Sound'
448c450
< assert (driver in ['alsa', 'oss', 'jack', 'portaudio', 'sndmgr', 'coreaudio', 'Direct Sound', 'dsound'])
---
> assert (driver in ['alsa', 'oss', 'jack', 'portaudio', 'sndmgr', 'coreaudio', 'Direct Sound', 'pulseaudio'])
525c527,536
< return fluid_synth_set_reverb(self.synth, roomsize, damping, width, level)
---
> set=0
> if roomsize>=0:
> set+=0b0001
> if damping>=0:
> set+=0b0010
> if width>=0:
> set+=0b0100
> if level>=0:
> set+=0b1000
> return fluid_synth_set_reverb_full(self.synth, set, roomsize, damping, width, level)
534c545,556
< return fluid_synth_set_chorus(self.synth, nr, level, speed, depth, type)
---
> set=0
> if nr>=0:
> set+=0b00001
> if level>=0:
> set+=0b00010
> if speed>=0:
> set+=0b00100
> if depth>=0:
> set+=0b01000
> if type>=0:
> set+=0b10000
> return fluid_synth_set_chorus_full(self.synth, set, nr, level, speed, depth, type)
Any guidance here for users? I have fluidsynth 1.1.11 (as advised in #19) and pyfluidsynth 1.2.5 from PyPI and I'm getting this error. My fluidsynth.so does not export fluid_synth_set_reverb_full
and co, and the fluidsynth source for 1.1.11 agrees as far as I can tell: https://github.com/FluidSynth/fluidsynth/blob/v1.1.11/include/fluidsynth/synth.h#L145.
@cooijmanstim and anybody else that finds this looking for a solution: sadly the official package has not been updated, but the changes above do work, so you can either make them yourself locally or do what I did and install the fork instead of the official version. Make sure all the old pytfluidsynth
stuff is uninstalled, then:
pip install git+https://github.com/0xf0f/pyfluidsynth
@bdoms thx for the tip! This also worked for me with fluidsynth 1.1.11 on Ubuntu 20.
Also hi @cooijmanstim fancy seeing you here :)
de3baa1b311996045b8ee8a2c659afb272d26723 should fix this :)
thx!!!
Looks like pyfluidsynth uses internal functions:
They are only used in the internal sources of fluidsynth and are not exported. They are also not present in the
include
directory for header files. Tested on Windows. Note: as is, it might work on Linux/Mac, but not on Windows.Suggested is to use the "public" API from
include
, which is properly exported in the DLL,Full error output: