[Coco] DW4 and Linux sound

Steven Hirsch snhirsch at gmail.com
Sun Nov 18 11:16:04 EST 2012


On Sat, 17 Nov 2012, Steven Hirsch wrote:

>> Pulseaudio is running fine here.
>> root at coyote:/var/spool/mail# ps -e |grep pulse
>> 2806 ?        00:07:33 pulseaudio
>
> That explains why you're not seeing Java hog the sound device.  I did some 
> reading up and it turns out that OpenJDK (and perhaps others) use pulse audio 
> if present.  Pulse (when it works, I guess, which it never has here) is 
> capable of handling multiple audio streams.

I finally found a coherent writeup of Java JVM sound device behavior:

http://www.developerfusion.com/article/84314/wired-for-sound/

some explanation of how to probe for Linux devices:

http://forum.subsonic.org/forum/viewtopic.php?t=2038

and some cryptic (and incomplete) explanation of configuring the jre:

http://www.voxforge.org/home/docs/faq/faq/how-to-modify-the-sound.properties-file-of-your-java-jre---linux

The short answer is that alsa requires (at a minimum) this in 
/etc/java-<your-java-version>/sound.properties:

javax.sound.sampled.Clip=com.sun.media.sound.DirectAudioDeviceProvider
javax.sound.sampled.Port=com.sun.media.sound.PortMixerProvider
javax.sound.sampled.SourceDataLine=com.sun.media.sound.DirectAudioDeviceProvider
javax.sound.sampled.TargetDataLine=com.sun.media.sound.DirectAudioDeviceProvider

and MAY need additional information appended according to the output of 
the little program from the second reference above, e.g.:

javax.sound.sampled.TargetDataLine=\
com.sun.media.sound.DirectAudioDeviceProvider#"Intel [plughw:0,0]"

or, perhaps

javax.sound.sampled.TargetDataLine=#"Intel [plughw:0,0]"

As is too often the case, this information was scattered far and wide with 
no single point of reference.

To recap:  OpenJDK uses PulseAudio by default and needs tweaking only if, 
like me, you have disabled Pulse due to other gross misbehavior.  Sun Java 
probably does need configuring or it will try to grap /dev/dsp directly 
and prevent everything else on the box from making sound.

I'm still bashing away at this, so feel free to point out any problem! As 
always, make backups of any configuration you might alter.

Steve


-- 




More information about the Coco mailing list