Does any1 know any good LWJGL3 OpenAL library?

I usually use Paul’s Code Sound System but recently I have found a few problems:

  • doesn’t work with LWJGL3
  • I can’t use inputstreams on it (I would like to use my own resource loader which returns an inputstream)
  • When looking through the source (trying to fix the above problems) I started to see many silly ideas put into it

Then I thought about making my own… But I have no idea about OpenAL, loading .wav and .ogg files, etc.

So does anybody know any library for LWJGL3 OpenAL which can:

  • load .wav and .ogg files from inputstream
  • streaming sound or music files
  • 3D surround sound with stuff like attenuation and doppler effect
  • play, pause and stop sounds

Some stuff which I dont actually want but it would be nice:

  • master volume
  • Java Sound backing if OpenAL isn’t supported
  • the ability to make a sound play slower

Thx in advance…

maybe it’s a good moment to switch to fmod.

http://www.fmod.org/
http://jerome.jouvie.free.fr/nativefmod/index.php

not sure about the licence tho’.

Hi

I use Paul Lamb Sound Library for years. Maybe you could modify your resource loader in order to return filenames or URLs instead of using this small limitation as a pretext to look for another library. Fmod isn’t necessary and I don’t like its license. Moreover, porting the plugin based on the second version of the library you use to the third one is quite easy to do and is (in my humble opinion) the most viable and easiest way of solving your problem. If you don’t want to do it, contact Paul on his forum. I assume that he will do it. If I were you, I would contribute even with no knowledge of OpenAL as the “job” is clearly delimited, you wouldn’t spend a lot of time on it and anyway it would be faster than switching to another library.

Edit.: Please avoid SMS language here. I find it particularly annoying to read. Keep in mind that some developers here aren’t native speakers and it just drives things harder to understand.

If you like, you can use Paul’s Code Sound System with LWJGL3. Ported it while working on a compatibility layer for LWJGL3. The LWJGL3 OpenAL library plug-in can be downloaded from here.

Good job, the source code is inside the JAR.

I’ve actually decided to give OpenAL a go myself… Because the only thing that was worrying was loading the files… But Java Sound can load wave and au files, then I can just use J-ogg to load .ogg files…

But if I am unsuccessful, I will look at your suggestions… Thanks for the help anyway!
Btw, would you happen to know what this means?

AL lib: (EE) UpdateDeviceParams: Failed to set 44100hz, got 48000hz instead

Thx in advance…

I’m sure that the very latest sound sample I added last night has a frequency of 44100hz. However, I don’t use the same plugin (for OpenAL). If it uses OpenAL-Soft under the hood, it will work. I assume that the plugin uses OpenAL hardware and 44100hz isn’t supported.

In my humble opinion, Java Sound is still too buggy to be useful.

Here’s my OpenAL stuff for LWJGL 2, not sure what it would take to make it work with 3.

I’ve been working on a LWJGL2 compatibility layer which runs on LWJGL3 (allows running LWJGL2 apps with very little source code changes). I did attempt to use it to port LibGDX to LWJGL3 (the audio part should work), however ran into a problem as LibGDX’s LwjglApplication class seems to want to run LWJGL on a secondary thread which didn’t sit well with GLFW. Ended up giving up after that point, did however get jMonkeyEngine3 working with it :).

With that error, nothing bad happens it still runs… Maybe it has something to do with the sound engine which came with my headset? (Razer Kraken 7.1 if u r wondering)

This library does not seem to work anymore as OpenAL binding has been changed even further? I tried to fix it by replacing instances of AL10.alListener with AL10.alListenerfv, but that seems to break the 3D sound.

Apparently AL10.alListener is not equal to AL10.alListenerfv, but I’m not sure how to fix it. Change them all to use AL10.alListener3f maybe?

The code broke because of API’s changes in LWJGL3 (it was in pre-alpha at the time), anyway I’ve updated the library to work with the latest nightly build of LWJGL3 and re-uploaded.

You can grab it from here.

I don’t know very accurately, but 44100Hz is the quality of Audio CDs. It is 44800Hz for DVDs, that message essentially means you have better hardware that can play more quality audio than you requested. It is the frequency of the sound I think.

Cheers! That’s very useful.

Linear attenuation seems to work properly now, but I’m still having problems with rolloff attenuation. No matter how far or at what angle am I as the listener from the audio source, the volume stays constant.

I think the problem is in the LWJGLOpenAL plugin, as disabling it and fallbacking to JavaSound makes it work properly.

[quote=“matanui159,post:6,topic:52523”]

[quote=“SHC,post:13,topic:52523”]
I have pushed a change for this (build #50), the default ALContext creation will not try to override the device’s ALC_FREQUENCY (or ALC_REFRESH). You shouldn’t see this message anymore.