PDA

View Full Version : Java sound on Ubuntu



m0nkeyk0ng
October 23rd, 2009, 08:09 AM
I am having trouble outputting sound (simple .wav or .au files) through Java on Ubuntu. I have tried following every basic approach out there short of installing the JMF API. I'm all out of ideas after spending half the day trying to get a beep or a buzz.

I am wondering if anyone else has run into a similar problem?

OpenGuard
October 23rd, 2009, 08:51 AM
Haven't used Java for such tasks, but wouldn't it be easier to use mpeg123 ( it's too small to not to give it a try ) ?

m0nkeyk0ng
October 23rd, 2009, 06:56 PM
I checked mpg123 and isn't it a C library?

Anyway, it appears the Java libraries require exclusive access to audio resources on Ubuntu in order to playback. This is not really pragmatic for the magnitude of the program.

http://linux.dsplabs.com.au/lsof-grep-snd-how-to-free-a-linux-sound-device-p25/

I'm going to try to run the code on my Windows box. But if anyone knows how to get around this issue, let me know.

--------------
edit:

Actually... problem solved! Kinda.

Root access is needed to access audio device, so I run the program with root privileges and it works. This isn't the most elegant solution, though. So if you have a better solution let me know!

OpenGuard
October 23rd, 2009, 07:07 PM
I checked mpg123 and isn't it a C library?


http://www.mpg123.de/ - it's a lightweight CLI based music player, not a C library.