no usable sound from java commandline programs - pulseaudio
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
no usable sound from java commandline programs - pulseaudio
**READ BELOW FOR CURRENT STATUS**
OK so under ALSA commandline java apps had sound(slackware14.1). Now that I'm on 14.2 this beast of pulseaudio was shoved upon us and now I can not get usable sound. I say usable sound because I can see in pavucontrol that the sound is being forced to my videocard's hdmi port. I have no way of telling it to use my sound card (EMU20K2 Soundblaster X-fi) I've tried pctl and still no luck. I tried clicking on the output but can not select the other card.
Any ideas?
Edit:
**** CURRENT STATUS ****
I thought I had it working, but after a power outage(with graceful shutdown, Thanks APC Backups) I booted this morning and I still have sound problems.
I'm using official Java8u112.
OpenAL1.17.2 via slackbuilds
Here is the symptoms.
When I boot the system I have sound. I can watch a youtube video, etc. I can see volume controls and use KDE's Audio and Video Settings. I can click each of the 4 speakers and hear "front left" "Rear right" etc. The second I run Java it kills ALL sounds. It even stops a youtube video dead in its tracks. This persists through logouts! I must reboot to clear this and get sound again from my sound card. Interestingly enough if I use pavucontrol and change the "CubeUtils (Firefox youtube)'s playback to GM204 HDMI I'll see mixer activity and the video will start playing(without sound). The video pauses(hangs) the second I select EMU20k2 again.
Things I've tried:
ps -ef | grep java (after Java is closed) no results so java is not currently running. yet sound is still dead.
~/.asoundrc configs (see below for both I've tried)
~/.alsoftrc (Quite possibly the worst documented sound plugin ever.)
/usr/lib64/java/jre/lib/sound.properties (see below for lines added)
/etc/pulse/default.pa (see below for lines added)
removing official Java and installing OpenJDK. (see below for sound.properties lines added)
I'm out of ideas now. I'm especially confused as to why it worked before and making the exact same changes results in different results now.
Have you tried using `aplay -l` to identify your sound cards, and then creating an .asoundrc file to define which card gets priority? Example, assuming your Emu card is card 1:
The problem is pulse is grabbing the sound. it is then forcing it to the wrong output. If you look at the first image, it shows that there is sound output on the hdmi device. (The bottom bar is a current output level display. That bar moves as sound it supposed to play. When I click the box that says "GM204 High...HDMI" it gives me an option button selection dropdown containing EMU20k2 however selecting it with either the mouse or keyboard and "space" to select it does nothing. It immediately reverts back to the HDMI.
And yes I have tried the asoundrc file.
my next step is to kill Pulse and see if the sound works in asla. Which I assume it will. This isn't a permanent solution as Pulse is required now...
-------Edit-------
If I "pactl exit" killing pulseaudio the sound works fine in the java app. The second I restart pulseaudio the sound is gone. So I am now sure it's a pulseaudio problem. Any idea how to fix it?
surely someone else here has a nvidia card and plays minecraft right?
updates:
So far none of the above worked. I was however able to figure out a way to get it working kinda
OpenAL was part of the problem
I needed to make a file ~/.alsoftrc
Code:
# ~/.alsoftrc
[pulse]
allow-moves=yes
I also needed to update my ~/.asoundrc file with:
Code:
pcm.!default {
type pulse
}
ctl.!default {
type pulse
}
pcm.pulse {
type pulse
}
ctl.pulse {
type pulse
}
The combination of these allows me to use pavucontrol (pulse Audio Volume Control) to select the output device once it is started (first file change) and the second file allows the sound to play.
I still have to manually change the output device every time from HDMI to EMU20k2 but at least I have sound. I believe the default device is from OpenAL
Code:
bash-4.3$ openal-info
Available playback devices:
GM204 High Definition Audio Controller Digital Stereo (HDMI)
EMU20k2 [X-Fi Titanium Series] (SB0880 [SoundBlaster X-Fi Titanium PCI-e]) Analog Surround 4.0
Available capture devices:
EMU20k2 [X-Fi Titanium Series] (SB0880 [SoundBlaster X-Fi Titanium PCI-e]) Analog Stereo
Monitor of GM204 High Definition Audio Controller Digital Stereo (HDMI)
Monitor of EMU20k2 [X-Fi Titanium Series] (SB0880 [SoundBlaster X-Fi Titanium PCI-e]) Analog Surround 4.0
Default playback device: GM204 High Definition Audio Controller Digital Stereo (HDMI)
Update: Sound is now completely fubar. Anything that tries to use sound except pulse native kills the sound system. I'm sure I've probably caused it by changing so many config files. I thought I changed them all back but I must have missed one.
I also tried removing official Java and installing OpenJDK and adding:
Try reinstalling (upgradepkg --reinstall) your audio packages, then go through the .new files and see what wasn't reverted back to the original conf files.
Also, check for an .asoundrc in your home directory to make sure it isn't overriding system defaults.
In this case the Java program is Minecraft. But the current status is that the entire sound system is now messed up even native sounds are not working anymore. I'll be trying bassmadrigal's suggestion of reinstalling all the sound subsystems. I think that's just ALSA and Pulse correct?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.