CGoban and Stone Sound

For discussing go computing, software announcements, etc.
Post Reply
User avatar
judicata
Lives in sente
Posts: 932
Joined: Wed Apr 21, 2010 12:55 pm
Rank: KGS 1k
GD Posts: 0
Universal go server handle: judicata
Location: New York, NY
Has thanked: 146 times
Been thanked: 150 times

CGoban and Stone Sound

Post by judicata »

Hey guys, I've upgraded to the latest version Ubuntu (from several versions - I think Intrepid to Lucid), and now I cannot hear the stones clicking on KGS (CGoban). On the positive side, I can still hear them when I run it in XP through virtualbox, but I'd much rather run it natively.

I can still hear the alarms and the voice audio (i.e. in lectures), just not the sound clicking. Installing oss and running it in aoss mode doesn't help.

Ideas?
User avatar
fwiffo
Gosei
Posts: 1435
Joined: Tue Apr 20, 2010 6:22 am
Rank: Out of practice
GD Posts: 1104
KGS: fwiffo
Location: California
Has thanked: 49 times
Been thanked: 168 times

Re: CGoban and Stone Sound

Post by fwiffo »

What flavor of java are you running? I recently discovered that upgrading ubuntu can result in your sun java getting replaced with some not-really-functional alternative.
User avatar
Bantari
Gosei
Posts: 1639
Joined: Sun Dec 06, 2009 6:34 pm
GD Posts: 0
Universal go server handle: Bantari
Location: Ponte Vedra
Has thanked: 642 times
Been thanked: 490 times

Re: CGoban and Stone Sound

Post by Bantari »

fwiffo wrote:What flavor of java are you running? I recently discovered that upgrading ubuntu can result in your sun java getting replaced with some not-really-functional alternative.


Yeah, that's what I have discovered too.
If I understand this correctly, though, the Java should still be the same, but the browser plugin is different.
- Bantari
______________________________________________
WARNING: This post might contain Opinions!!
User avatar
fwiffo
Gosei
Posts: 1435
Joined: Tue Apr 20, 2010 6:22 am
Rank: Out of practice
GD Posts: 1104
KGS: fwiffo
Location: California
Has thanked: 49 times
Been thanked: 168 times

Re: CGoban and Stone Sound

Post by fwiffo »

In my case it screwed up both, which kept it from working with the "-open" switch, so I couldn't open SGF files easily. And the fonts were wrong. And the sound didn't work. And everything looked funny.
User avatar
judicata
Lives in sente
Posts: 932
Joined: Wed Apr 21, 2010 12:55 pm
Rank: KGS 1k
GD Posts: 0
Universal go server handle: judicata
Location: New York, NY
Has thanked: 146 times
Been thanked: 150 times

Re: CGoban and Stone Sound

Post by judicata »

I'll double-check, but I think I've replaced it with sun-java and nothing happened really. The fonts DO look different than in Windows though, so maybe you're on to something.
User avatar
judicata
Lives in sente
Posts: 932
Joined: Wed Apr 21, 2010 12:55 pm
Rank: KGS 1k
GD Posts: 0
Universal go server handle: judicata
Location: New York, NY
Has thanked: 146 times
Been thanked: 150 times

Re: CGoban and Stone Sound

Post by judicata »

Yippee! Thanks Fwiffo! I had installed sun-java, but had NOT removed open-jdk. Once I did that, I got my stone clicks back. Although the font still looks different, I actually like it a little better; and it loads much faster.

This makes me happier than it probably should, but that's okay.

For posterity: go to synaptic and install the sun-java6-jre package and remove openjdk-6-jdk, and openjdk-6-jre and similar packages.
User avatar
cdybeijing
Lives in gote
Posts: 581
Joined: Fri Apr 30, 2010 2:27 am
Rank: IGS 2 dan
GD Posts: 0
Location: Shanghai, China
Has thanked: 96 times
Been thanked: 100 times
Contact:

Re: CGoban and Stone Sound

Post by cdybeijing »

judicata wrote:Yippee! Thanks Fwiffo! I had installed sun-java, but had NOT removed open-jdk. Once I did that, I got my stone clicks back. Although the font still looks different, I actually like it a little better; and it loads much faster.

This makes me happier than it probably should, but that's okay.

For posterity: go to synaptic and install the sun-java6-jre package and remove openjdk-6-jdk, and openjdk-6-jre and similar packages.


I wondered for a long time why I was having the exact same problem. This is great, thanks.
User avatar
wms
Lives in gote
Posts: 450
Joined: Tue Apr 20, 2010 4:23 pm
GD Posts: 0
KGS: wms
Location: Portland, OR USA
Has thanked: 257 times
Been thanked: 287 times
Contact:

Re: CGoban and Stone Sound

Post by wms »

It's so frustrating that Ubuntu uses the "-open" version by default. Sun java sucks bad enough, but the "-open" version is even worse. So many little bugs that it has in *addition* to all the irritations of Sun's version. :(

Well, glad you got it straightened out in the end!
User avatar
fwiffo
Gosei
Posts: 1435
Joined: Tue Apr 20, 2010 6:22 am
Rank: Out of practice
GD Posts: 1104
KGS: fwiffo
Location: California
Has thanked: 49 times
Been thanked: 168 times

Re: CGoban and Stone Sound

Post by fwiffo »

I actually don't think you have to remove the openjdk version, you just have to use update-alternatives to set sun java as the default.
User avatar
daniel_the_smith
Gosei
Posts: 2116
Joined: Wed Apr 21, 2010 8:51 am
Rank: 2d AGA
GD Posts: 1193
KGS: lavalamp
Tygem: imapenguin
IGS: lavalamp
OGS: daniel_the_smith
Location: Silicon Valley
Has thanked: 152 times
Been thanked: 330 times
Contact:

Re: CGoban and Stone Sound

Post by daniel_the_smith »

Oh, I have this problem too, I'll have to see if that fixes it...
That which can be destroyed by the truth should be.
--
My (sadly neglected, but not forgotten) project: http://dailyjoseki.com
User avatar
judicata
Lives in sente
Posts: 932
Joined: Wed Apr 21, 2010 12:55 pm
Rank: KGS 1k
GD Posts: 0
Universal go server handle: judicata
Location: New York, NY
Has thanked: 146 times
Been thanked: 150 times

Re: CGoban and Stone Sound

Post by judicata »

fwiffo wrote:I actually don't think you have to remove the openjdk version, you just have to use update-alternatives to set sun java as the default.


I tried that first and got an error. I may have just typed the command wrong, though; I'm not at home so I can't double check.

A primary reason I use Ubuntu is that I strongly prefer open software, so I hate it when things don't work right.

On an unlreted note, I also hate it when some design team makes almost arbitrary decisions that completely depart from established practice, with little or no benefit to usability. Case in point: moving all of the window controls (minimize, maximize, close) from the upper-right side of a window to the upper-left. Even better, there wasn't an obvious way to change it back (although it is pretty easy to do--just not obvious).
User avatar
cdybeijing
Lives in gote
Posts: 581
Joined: Fri Apr 30, 2010 2:27 am
Rank: IGS 2 dan
GD Posts: 0
Location: Shanghai, China
Has thanked: 96 times
Been thanked: 100 times
Contact:

Re: CGoban and Stone Sound

Post by cdybeijing »

judicata wrote:
fwiffo wrote:I actually don't think you have to remove the openjdk version, you just have to use update-alternatives to set sun java as the default.


I tried that first and got an error. I may have just typed the command wrong, though; I'm not at home so I can't double check.

A primary reason I use Ubuntu is that I strongly prefer open software, so I hate it when things don't work right.

On an unlreted note, I also hate it when some design team makes almost arbitrary decisions that completely depart from established practice, with little or no benefit to usability. Case in point: moving all of the window controls (minimize, maximize, close) from the upper-right side of a window to the upper-left. Even better, there wasn't an obvious way to change it back (although it is pretty easy to do--just not obvious).


After getting used to Lucid since its initial release, I now wish there was an easy way for me to change the window controls on my Windows work pc from the right side to the left...
User avatar
judicata
Lives in sente
Posts: 932
Joined: Wed Apr 21, 2010 12:55 pm
Rank: KGS 1k
GD Posts: 0
Universal go server handle: judicata
Location: New York, NY
Has thanked: 146 times
Been thanked: 150 times

Re: CGoban and Stone Sound

Post by judicata »

Even after the action described above, I could only hear cgoban and nothing else.

Then, I found this thread, which gets java to use aoss without having to launch through a terminal each time.

First, make sure you have aoss installed, then:

Code: Select all

cd /usr/lib/jvm/java-6-sun/jre/bin
sudo mv java java.bin
sudo touch java
sudo chmod +x java
sudo gedit java

Then, insert the following code into the java file

Code: Select all

#!/bin/bash
aoss /usr/lib/jvm/java-6-sun/jre/bin/java.bin "$@"


Should be good to go.
C. Blue
Dies in gote
Posts: 69
Joined: Thu Oct 07, 2010 4:45 am
Rank: EGF 1d
GD Posts: 0
KGS: CBlue
Has thanked: 29 times
Been thanked: 29 times

Re: CGoban and Stone Sound

Post by C. Blue »

The command to "activate" one of several installed Java flavours is

sudo update-alternatives --config java

Note that basic OpenJDK-Java in Ubuntu, as WMS hinted, will be usually glitchy enough to not produce any stone sound at all, as was said above, while SunJava (now acquired by Oracle) will produce sound fine, but on 99% of modern sound hardware (ie ones lacking multi-channel hardware-mixing) will hog the sound device and therefore prevent other apps from playing sound while cgoban is running. Or the other way round, if another app is already playing music, Java (and Cgoban) will not produce sound.

To fix this by wrapping the Java sound output into a mixable stream, with Ubuntu for a while now shipping with Pulseaudio as default sound server, you might want to try padsp instead of aoss. You might have to install Pulseaudio utilities to get it, I'm not entirely sure and too lazy to check right now :-p. But you might want pavucontrol and padevchooser anyway, so just install all pulseaudio tools you can find. Similar to aoss, the command then will be

padsp javaws cgoban.jnlp

or for stand-alone aka offline version of CGoban, if you downloaded one

padsp java -jar cgobanwhatever.jar

Apart from latest Ubuntu going for Pulseaudio instead of just ALSA, personally I found padsp working more reliably than aoss, although it can still cease working after a while depending on various factors (if some preloading goes bad). If that happens, it might be required to terminate all apps that currently utilize Pulseaudio, then restart them and cgoban. (Basically same annoying procedure that would also happen to aoss).

The technically most low-level and therefore supposedly most reliable approach would be ossproxy, which however is still sort of beta or even alpha.. for many people it seems to work, but sometimes it just doesn't work at all, and also it requires certain kernel configs and possibly compiling stuff (possibly including kernel) yourself. OSSproxy creates fake sound devices, and sort of forwards all input to the pulseaudio server (or ALSA, if desired on different distros than Ubuntu). For this, a kernel is required that doesn't preclaim OSS device paths, and also a CUSE-supporting FUSE library will be neccesary, so things get a bit technical. Basically, search for OSSproxy on Sourceforge, to get the latest code.

As a side note, you might wonder about claims how Java supports ALSA - this doesn't mean it won't hog the oss sound device (aka /dev/dsp) unfortunately. Although it utilizes ALSA, it'll still try to reserve it exclusively..so yeah, padsp all the way (or aoss on older/other Linux distributions).
Post Reply