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

[audio] Is there a lightweight alternative to OpenAL Soft? #52

Closed
raysan5 opened this issue Sep 13, 2015 · 19 comments
Closed

[audio] Is there a lightweight alternative to OpenAL Soft? #52

raysan5 opened this issue Sep 13, 2015 · 19 comments
Labels
enhancement This is an improvement of some feature

Comments

@raysan5
Copy link
Owner

raysan5 commented Sep 13, 2015

Since raylib creation I've been looking for an alternative to OpenAL Soft. It works great but OpenAL Soft is a very big library and raylib programs must be distributed with openal32.dll, I don't like it.

Ideally, I would like to find an audio library with the following features:

  • Lightweight, compilable as an small static library or a header-only library (similar to stb libraries) to be added to the executable on compilation.
  • Multiplatform, it should work (or have versions) on Windows, Linux, OSX, Android, RaspberryPi and HTML5.
  • Easy to use interface (similar to OpenAL Soft) is desirable.
  • No fancy effects or real-time audio postprocessing required, just play audio.

I've been analyzing the possibility of using PortAudio, but I'm not sure if it would be a good replacement... ¿any ideas?¿anyone knows about an alternative?

@raysan5 raysan5 added question enhancement This is an improvement of some feature labels Sep 13, 2015
@unity-car-tutorials
Copy link

I saw this lightweight cross-platform audio library on Hacker News a few days ago.

http://libsound.io/

Have you also considered SDL2_mixer, or plain SDL2, which are both cross platform MIT licensed?

@raysan5
Copy link
Owner Author

raysan5 commented Sep 13, 2015

Hello clix9, libsound.io looks very good, I'll take a closer look.

SDL2_mixer has many external dependencies that I'm trying to avoid (flac, libmikmod, libogg, libvorbis, smpeg). I just want access to audio device.

SDL2 itself would be a full replacement for raylib... :P

@cdoty
Copy link

cdoty commented Sep 15, 2015

Hekkus sound system is a nice library and he has considered open sourcing it. It can play wave, ogg files, and mod music files. It supports nearly any modern device, except maybe BlackBerry. Porting it to a new system is very easy.

@raysan5
Copy link
Owner Author

raysan5 commented Sep 17, 2015

Thanks for the info cdoty! I've been taking a look to Hekkus and it's too big for my taste; I'm looking for something simpler and lightweight, no external dependencies, no need for lots of audio formats support... libsound.io really seems a good candidate.

@raysan5
Copy link
Owner Author

raysan5 commented Aug 13, 2016

Just for reference, here it is an interesting audio library: https://github.com/kinetiknz/cubeb

@oskaritimperi
Copy link
Contributor

Isn't it possible to compile openal-soft statically, in which case the dll would not need to be distributed?

@raysan5
Copy link
Owner Author

raysan5 commented Sep 26, 2016

I think so but last time I tried I got some missing dependencies with my old MinGW and I just left it... I've just updated MinGW to latest version and need to try again...

@raysan5
Copy link
Owner Author

raysan5 commented Sep 28, 2016

@oswjk, I just tried compiling OpenAL Soft as static library using latest MinGW and CMake and it didn't work for me... did you tried it? did it work for you?

@oskaritimperi
Copy link
Contributor

At least on Linux it went smoothly. I'll try to compile it on Windows tomorrow.

@oskaritimperi
Copy link
Contributor

I cloned https://github.com/kcat/openal-soft and did the following:

> cd build
> cmake -G "MinGW Makefiles" -DLIBTYPE=STATIC ..
> cmake --build .

And the build completed successfully. I'm using mingw64 from msys2. I also tried to compile the library statically with VS2015 and it worked fine too.

@pixelpicosean
Copy link

Try SoLoud, it's an amazing sound library.

@raysan5
Copy link
Owner Author

raysan5 commented Oct 4, 2016

Hi @oswjk, I tried running cmake again for openal-soft (master branch) using MinGW (32bit, GCC 5.3.0) and running from Windows CMD and it didn't work (here it is output log). It also keeps poping malware messages from Windows Defender (probably related to programs that cmake tries to run). I imagine is a related to permissions...

UPDATE: Ok, I tried again running CMake as administrator and Makefile generation worked ok but when trying to build, it failed (output log)... got a redefinition of 'struct timespec'... Tried to solve the issue manually but got a new bunch of errors...

@raysan5
Copy link
Owner Author

raysan5 commented Oct 4, 2016

Hi @pixelpicosean! Thanks for the proposal, I knew SoLoud but I discarded it earlier for being C++... now I see there is also a C API...

For the moment I will continue with OpenAL (really multiplatform) but I would like to use it as static lib and if possible reduce it size (don't need most of the extension features)...

I know it's asking for too much but it would be amazing a simple single-file header-only audio library to just open-close audio device and push data for playing...

@oskaritimperi
Copy link
Contributor

@raysan5 The errors you were receiving might be caused by antivirus tools. Someone has had similar problems earlier (http://public.kitware.com/pipermail/cmake/2014-March/057171.html).

I haven't seen such problems earlier on any of my Windows machines. The antivirus is my best bet, because you said that defender keeps popping up.

@raysan5
Copy link
Owner Author

raysan5 commented Oct 4, 2016

Hey @oswjk, thanks for the answer! Yes, I already solved that issue with permissions, the problem seems to be in MinGW32 libs (http://openal.org/pipermail/openal/2014-May/000123.html), there are some incompatibilities...

@raysan5
Copy link
Owner Author

raysan5 commented Oct 15, 2016

Finally I managed to compile OpenAL Soft statically with MinGW32, there were some issues with MinGW32 libs (solved in MinGW-w64) and OpenAL Soft current CMake configuration.

More info here: kcat/openal-soft#13

Right now I'm quite happy with OpenAL Soft API, I'm closing this issue.

@gen2brain
Copy link
Contributor

https://github.com/dr-soft/mini_al looks nice. Single header, public domain. I don't see it in recommendations. Supports Linux (ALSA), Windows (DirectSound/WASAPI), Android (OpenSL|ES) and Other (OpenAL) . Doesn't have direct support for CoreAudio on OSX but there it can use OpenAL like it is now.

And there is also https://github.com/RandyGaul/tinyheaders/blob/master/tinysound.h with DirectSound, CoreAudio and SDL2 (for other, not very nice).

@raysan5
Copy link
Owner Author

raysan5 commented Oct 30, 2017

Hey @gen2brain, thanks for the proposed libs! mini_al looks great, I'll keep an eye on it.

Right now reimplementing audio module with a new module implies some work, need to analize it carefully...

michaelfiber pushed a commit to michaelfiber/raylib that referenced this issue Sep 21, 2023
Update raylib_textures.c with square gradient
@ericoporto
Copy link

There's MojoAL

https://github.com/icculus/mojoAL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This is an improvement of some feature
Projects
None yet
Development

No branches or pull requests

7 participants