Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

function 'fluid_synth_set_reverb_full' not found #12

Closed
tingtron opened this issue Oct 25, 2018 · 7 comments
Closed

function 'fluid_synth_set_reverb_full' not found #12

tingtron opened this issue Oct 25, 2018 · 7 comments

Comments

@tingtron
Copy link

tingtron commented Oct 25, 2018

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 from include, 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 <module>
    import fluidsynth
  File "c:\Tools\Python27\lib\site-packages\fluidsynth.py", line 188, in <module>
    ('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
@ChristianRomberg
Copy link
Collaborator

ChristianRomberg commented Oct 27, 2018 via email

@tingtron
Copy link
Author

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)

@cooijmanstim
Copy link

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.

@bdoms
Copy link

bdoms commented Jun 9, 2020

@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

@chrisdonahue
Copy link

@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 :)

@albedozero
Copy link
Collaborator

de3baa1 should fix this :)

@chrisdonahue
Copy link

thx!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants