Java sound doesn't work under Linux

5

1

I just installed Fedora 12 and after downloading and running the Java Sound Demo I get exceptions. If I run just a vanilla Java program that plays a .wav file it runs silently with no sound and no exceptions.

Every other app seems to play sound. I also took some advice from this thread in the Ubuntu forums which almost seemed to work. (Installing aoss got rid of the initial exceptions in the sound demo but I still hear nothing when I play.)

I'm getting frustrated by the individual hoops I have to go through to eek sound out of my speakers when running Java apps on Linux platforms!

Can somebody help me figure out what's wrong?

Cliff

Posted 2010-05-26T14:59:37.023

Reputation:

Answers

2

I've found my own answer. From the list of things you should'a learned in Kindergarten:

If you have a second sound card in your box, like one that didn't originally work with Linux and caused you to start using the built-in support on your motherboard, then you will probably not realize that Java audio support goes to the sound card you aren't using. What that means is that even though all of my other audio was going to the card I activated using the mixer in the system tray, Java decided to route its audio to the other card.

So all along the audio actually was playing happily. I just couldn't hear it because it was playing on the Sound Blaster XFi card and I had my speaker plugged into the motherboard's audio port. I apologize if I sound smug but I'm frustrated and not having much fun especially after seeing that a serious issue can get voted down leaving the answer to that serious issue hidden to others facing the same woes.

I'm not slamming Linux, Fedora or Java. I'm just trying to understand why something that should be simple has caused such complicated research. I figured this out almost by accident as an article tipped me off that Java audio support might actually pick a different driver to route audio.

Cliff

Posted 2010-05-26T14:59:37.023

Reputation: 309

Hardly transferable question and answer to other users, and vital information for answer not given in question – Cookie – 2011-12-20T01:17:43.110

I don't follow. The vital information was that my box had 2 sound cards installed. Linux and all of the apps installed were correctly routing to the motherboard sound card that had speakers connected while Java defaulted audio routing to the secondary Sound Blaster sound card where nothing was connected. Plugging my speakers into the sound blaster card fixed the problem. I recall there was a way to route Java audio to the other card as well but its been so long that I cannot remember. – Cliff – 2011-12-20T18:16:20.940

1

Curiously enough, a fix for me was to add a config file ~/.alsoftrc with the contents:

[pulse]
allow-moves=yes

The java application in my situation (Minecraft on Xubuntu 14.04 LTS) refused to use the audio output that actually worked (digital audio hdmi) and instead defaulted to something that didn't exist, analog audio.

Just putting this here for the next person wondering why java won't do sound correctly.

Chris K

Posted 2010-05-26T14:59:37.023

Reputation: 923

0

I have the same problem. When you use another program that uses sound before you start your java program that uses sound, your java sound won't work. It looks like that java sound is not using the Alsa mixer but tries to use the hardware after the Alsa mixer. Only a restart resolves the problem then.

Roy Damman

Posted 2010-05-26T14:59:37.023

Reputation: 1