Monday, September 12, 2011

And There Is Java Sound

Sometimes one creates a post just as a way to document something that they do not do that often. In a few months when I have to do this again, it'll be here. That is the case today. :)

We are getting our first application that uses Java to deliver sound, and of course it has no way by default of delivering to the thin clients. After some Googling and poking around, the process is not terrible. I installed Java 1.6.27 into /usr/java and then got the open source version of Java in RPM format and extracted the two PULSEAUDIO files:

rpm2cpio java-1_6_0-openjdk- | cpio -ivd ./usr/lib64/jvm/java-1.6.0-openjdk-1.6.0/jre/lib/amd64/

rpm2cpio java-1_6_0-openjdk- | cpio -ivd ./usr/lib64/jvm/java-1.6.0-openjdk-1.6.0/jre/lib/ext/pulse-java.jar

I then extracted the file as an example of how to add the lines for PULSE.

rpm2cpio java-1_6_0-openjdk- | cpio -ivd ./usr/lib64/jvm/java-1.6.0-openjdk-1.6.0/jre/lib/

You then hand move these files into the appropriate folders in the real Sun release, and merge in the PULSE lines into the file. Restart your browser and Java sees PULSE and considers it a sound card. Very nice, we now have sound.

In the shot below, the vendor software is displaying the sound card and the clips play nicely.


Mark said...

Why not just use IcedTea/OpenJDK with pulseaudio support directly instead?

Dave Richards said...

@Mark: In a perfect world that would be ideal. But the people that write web software are first to blame anything that is different on your side. Instead of working with open standards, much of this "cloud" software barely works and is poorly written. If they can blame something on your side they do, and then put it back on you to make things work. So I always use "real" Java from Oracle/Sun in order to put it back on them. That's why I have to use "real" Flash and Adobe Acrobat Reader too.