I have looked up a thousand and one different different ways to reproduce sound in LWJGL. None of them seem to work. It almost seems futile. All of them seemed to give errors, and those which didn't, threw a NullPointerException to my WAV sound.

Issue is, I've tried it on my game, and it seemed to fail. So, I copied the entire tutorial on a seperate class, changed the sound names to fit with the sound I had (I only used the WAV format and omitted the rest), and ran the program.

I'm just pegging a position so as to get updates. I am in the process of converting my game to libgdx and this will include my sound library, so I am very curious what the issues turn out to be. It will probably be a week or so before I know if my sounds work in the context of libgdx.

"We all secretly believe we are right about everything and, by extension, we are all wrong." W. Storr, The Unpersuadables

I would've liked to reply sooner, but I wasn't notified about this page, how are the .jars mismatched if they came from the exact same zip file? I've also tried overwriting the lwjgl .jars too, along with their natives(with versions 2.90, 2.85, and 2.81), and they don't seem to work..

Quick check: are you using Eclipse? Have you linked the libraries? I am putting the needed jars in "Referenced Libraries", as part of the build path. (I ask because the error message says there is trouble locating the needed classes.)

I am going to try the tutorial you linked now. I just ran the "LWJGL Basics" for the first time earlier this week--haven't tried the "Slick" tutorials yet.

"We all secretly believe we are right about everything and, by extension, we are all wrong." W. Storr, The Unpersuadables

OK, I got the tutorial to work. It is playing something...gack! I'm not sure each sound is exactly as it should be. There is no visual interface to speak of, just a blank screen. Ah-hah! You are supposed to play QWERT keys to get the various sounds. Yep. They all work.

Steps I took (there is probably a simpler way):

1) Download the complete Slick.zip. From within (slick/testdata/...) I copied the audio data files listed in the SoundExample program into a folder in the Eclipse project which I also named "testdata".

I had set up my project with a package named "lwjglTutorials" and put the tutorial class source file there. Setting the required testdata folder at src/lwgjlTutorials/testdata did NOT work. However, the program was able to find the resources when I changed the location to "src/testdata". (Have to look at the API for ResourceLoader() to find out exactly what is expected here.)

2) I linked as an "external jar" the following jars, all which can be found in either the Slick/lib or slick-util/lib folder: jogg-0.0.7.jar jorbis-0.0.15.jar ibxm.jar

Earlier I had linked lwjgl.jar and slick-util.jar.

That's a lot to do--perhaps there was a simpler way to set this up without requiring all the additional steps.

Hope that gets you rolling. If not, I'm happy to try and help further.

"We all secretly believe we are right about everything and, by extension, we are all wrong." W. Storr, The Unpersuadables

I am using Eclipse, I made SURE to add them to the referenced libraries, otherwise the rest of my game wouldn't work, and I even went as far as adding a few of the slick util libraries as well. Sound did not work.

But then I saw a .wav file inside the slick.zip (not slick-util.zip), and tried it out, and it did in fact work. It turns out my .wav files were transferred from MP3 files before. So that likely messed up the bytecode. Thank you very much for solving my issue.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org