Sound on Debian Jessie Linux

I have spent all day at work trying to get the sound to work in my game on our Debian Jessie Linux system. The game plays just fine, but there is no sound. We have the PulseAudio soundcard. Most of the articles I’ve read have said to change a file and uncomment something, but the problem is that I do not have administrative access to even open these files, much less change them. So my question is, am I just out of luck here, or is there some work around? I read that closing everything that might use the soundcard would work, but I coulndn’t get it to. I’m using the newest Java update and just playing audio with audio.play() in AWT. Also should state that the sound plays just fine in Windows. Thank you guys!

Edit: I am not getting any errors about sound in the console either.

[quote] Most of the articles I’ve read have said to change a file and uncomment something, but the problem is that I do not have administrative access to even open these files, much less change them.
[/quote]
I don’t know a lot about Linux, but isn’t the deal for getting administrative access something like going to a control prompt (is the program named Terminal?) and typing “sudo” before the command that you want to execute? Of course, that assumes you know the admin password.

Oracle or OpenJDK? IIRC the Oracle one doesn’t include PulseAudio support.

Why would you do that?

I don’t know a lot about Linux, but isn’t the deal for getting administrative access something like going to a control prompt (is the program named Terminal?) and typing “sudo” before the command that you want to execute? Of course, that assumes you know the admin password.
[/quote]
I would have no idea what the admin password would be, I’m not that high up at work

OpenJDK

I knew that was coming. The answer is, that’s just how I started the project and the audio is not a priority at the moment. One of the last things I’ll do is figure out a different way of handling it. I just wanted to see if I could figure out this sound situation on different computers so I can handle any problems that might come up in the future. Thanks for the responses guys!

Just to double check, because I’m not sure what you mean when you say you are using AWT’s sound. AFAIK, there is no play() method for audio in the AWT library.

The main sound libraries for Java audio playback are contained in javax.sound.sampled. The output classes that should be already implemented and running on any system that runs Java are the Clip and the SourceDataLine. Are you trying to execute the play() method of a Clip?

What is the class of the “audio” variable you mentioned in your original post, as in “audio.play()”?

There’s one in Applet. I think it might be using JavaSound under the covers anyway, but doing anything with Applet seems pointless in this day and age. ;D

… hmmm, that JavaDoc says nothing happens if the audio clip cannot be found! Are you sure you’re finding the URL of the file correctly?

I am extending Applet and using the toolkit to access all images and sounds. All of the sounds are AudioClip, and then I just play them using whateversound.play(); I’m sure it CAN can access them, because the sound works when no other programs are open. But when anything like a web browser is open, java sound either cannot or will not access the soundcard (I also tried it with other games to the same avail).

Maybe worth noting that the sound plays in Windows just fine.

OK, that means it’s reverting to using the direct ALSA device, which is exclusive - only one application can access this at a time. PulseAudio should be the default audio device. Which means either -

a) OpenJDK is using the direct ALSA device for Applet audio output (really, you shouldn’t be using these methods for audio - use JavaSound or check out TinySound if you want something simpler on top).

or, b) someone has changed the configuration of OpenJDK on that machine not to use PulseAudio.

Thanks, I will definatelly check out JavaSound and TinySound. I always planned on changing how I handled the audio and I was going to wait until the end, but maybe I’ll make that my project for tomorrow.

Meanwhile I’m going to try and see if I am able to change the system sound settings. I’ll let you guys know if I make any progress. Thanks again for all the help!

@nsigma wow! I changed sound managment from applet methods to JavaSound, and the difference on this linux system is amazing. Previously, with the applet methods on Linux, the game was stuttering every once in a while. I thought it was because this crappy system was trying to do too many things at once since I always have multiple programs open. But with JavaSound, there is no more stutter. (Just to clarify, the game runs great in Windows with either applet or java sound). But in general I feel so much better about using a proper sound interface (even though I know there are better ones, but I’m a beginner so this is a step up!).

With that being said, there is still no sound, but I’m not sure if it’s due to PulseAudio anymore…I get this exception:
javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, big-endian not supported

I have investigated, and I believe it means that the line I’m trying to access is not available. Is this due to something else (like the web browser) already accesing the sound card? Or is this AU file, which is in CD format except for being AU and not WAV, unsupported?

Try little-endian. I think it is more common. This is the format I always use and I’ve not had any troubles like you describe. My Linux is a different version though, as I use Ubuntu.