linuxnoob Posted October 4, 2008 Share Posted October 4, 2008 Hello. How I can change my sound device in sun java? I have a C-media USB headset, and i got other sounds working with asoundconf set-default-card default , but in java applets and programs sounds are still coming from my motherboard's VIA 8237. - So how I can set java sound device to C-Media USB Headphone Set? Link to comment Share on other sites More sharing options...
Elv13 Posted October 4, 2008 Share Posted October 4, 2008 if I remember, their is a programm called sox that can pipe sound from a device to another one. Link to comment Share on other sites More sharing options...
linuxnoob Posted October 4, 2008 Author Share Posted October 4, 2008 soxSwiss army knife of sound processing SoX is a command line utility that can convert various formats of computer audio files in to other formats. It can also apply various effects to these sound files during the conversion. As an added bonus, SoX can play and record audio files on several unix-style platforms. SoX is able to handle formats like Ogg Vorbis, MP3, WAV, AIFF, VOC, SND, AU, GSM and several more. Any format support requires at least libsox-fmt-base. Some formats have their own package e.g. Ogg Vorbis is provided by libsox-fmt-ogg. SoX supports most common sound architectures i.e. Alsa, Libao and OSS (provided by libsox-fmt-alsa, libsox-fmt-ao and libsox-fmt-oss). It also supports LADSPA plugins. Hmm.. I'm not sure if this sox is right program.. but if it is, how I have to use it so that I can get sounds working with Java?.. :unsure: Isn't there any easier ways? Btw. If I disable soundcard from BIOS will usb headset be default sound device then? If not how I can set it to default? Link to comment Share on other sites More sharing options...
Elv13 Posted October 4, 2008 Share Posted October 4, 2008 rm /dev/dsp ln -s /dev/dsp<probably 1, but check if it exist> /dev/dsp if it work, you will have to do a script that run during boot (in /etc/rc.d/rc.local or the similar file that your distribution provide). It is the bad way of doing it, but the easyest one. soxmis the right one. It look like sox -c 2 -s -w -r 32000 -t ossdsp /dev/dsp<probably 1, but check if it exist> -t ossdsp -w -r 32000 /dev/dsp I don't have 2 sound card, so I can't say if this is the right command (sox is, but this command is just a copy paste from the gentoo wiki) Link to comment Share on other sites More sharing options...
linuxnoob Posted October 5, 2008 Author Share Posted October 5, 2008 I disabled my onboard device from bios. and after that there's no /dev/dsp file anymore. Sounds still didn't work in Java, but when i typed sudo ln -s /dev/dsp1 /dev/dsp to terminal. I got sounds working in java, but now when I have java applet or program running, other sounds are not working :s Any ideas, how I can get all sounds workin at the same time? :argh: everything was so simple in windos xp... Link to comment Share on other sites More sharing options...
Elv13 Posted October 5, 2008 Share Posted October 5, 2008 It is normal, I said it was the bad way. Java work with OSS emulation, a really old way of managing sound. Only 1 prosess can access use the device at the same time, and you even ahave to restart alasasound sometime because the prosess crash it. Since let say, 5 years, this method is deprecated, now, modern apps should use alsamixer, a simple mixer apps that allow multiple apps to use sound at the same time. More powerfull mixer exist, like gstreamer, jack dans pulseaudio, they are even better. Ubuntu use pulseaudio by default. But java do not seem to be awre about it and use the old way and lock your device. On tip that i found while googling your problem is that in the sound config panel of ubuntu, switch pulseaudio to use alsamixer instead of accecing the sound card directly, it may help. If alsamixer is un use, java will use it (I did not try). Link to comment Share on other sites More sharing options...
Recommended Posts