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

[Feature request] Support for OpenAL backend #1119

Open
s-d-m opened this issue Jun 21, 2022 · 3 comments
Open

[Feature request] Support for OpenAL backend #1119

s-d-m opened this issue Jun 21, 2022 · 3 comments

Comments

@s-d-m
Copy link

s-d-m commented Jun 21, 2022

The audio backend "natively" supported by webassembly is OpenAL, which fluidsynth does not support at the moment. Adding it would make using fluidsynth on web applications easy.

Current alternatives are:
1/ trying to use SDL audio as fluidsynth backend, and hook SDL audio output to webassembly but that makes for a complicated setup.
2/ use fluid_synth_write_s16 to get audio data from fluidsynth into a buffer, and then push that buffer to openAL. You can see this in action here https://gist.github.com/take-cheeze/43f026d07547b9399738 or in my personal toy project at https://github.com/s-d-m/lilyplayer/blob/dba2dfd5484c71b5de49a96e9a18e2d8776f5c1c/src/sound_player.cc#L89-L114

To make fluidsynth available to webassembly, on top of OpenAl support, the changes at https://github.com/jet2jet/fluidsynth-emscripten are also useful.

@derselbst
Copy link
Member

You're welcome to file a PR for that. I currently don't have time for it.

@s-d-m
Copy link
Author

s-d-m commented Aug 1, 2022

Reading a bit into how openAL works (I admittedly didn't extensively went through it), it looks to me that the proper way to do it is by using the alternative #2 I wrote above. Unless someone with better understanding of openAL can come and correct me here, I think this feature request is a non-issue and can be closed.

@ThreeDeeJay
Copy link

OpenAL (Soft) used to have MIDI support so perhaps there's anything useful in the old code that was removed: kcat/openal-soft@6689c61
I for one would also like FluidSynth to support OpenAL, but for a different reason: (3D) spatial audio and (EAX) reverb.
If every instrument (or even note) was treated as an OpenAL sound emitter/object, it could be spatialized using attributes like note balance and pitch for the X and Y coordinates or something like this https://youtu.be/h8og1oL8JVY or https://youtu.be/EmuWIuI9e-c

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

No branches or pull requests

3 participants