stone clicking sound missing - windows 7

Comments, questions, rants, etc, that are specifically about KGS go here.
BadPotato
Beginner
Posts: 2
Joined: Sat Feb 12, 2011 4:56 pm
Rank: 4kyu
GD Posts: 0

Re: stone clicking sound missing - windows 7

Post by BadPotato »

I found an easy way to make it work without unstalling anythin.. it should work on windows, linux and probably mac, but I'll explain for the windows user.

Look in your program file and try to find the a folder called something like jre version 6(it should still be there if cgoban used to work well on your computer) and try to run it in command line(start > execute ... and type "cmd"). I did it like this:

Code: Select all

 C:\>"C:\Program Files\Java\jre6\bin\java.exe" -version
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode)


If you got this output with the 1.6 version, you found the right file.
Now download the offline ".jar" of cgoban here:
==> http://files.gokgs.com/javaBin/cgoban.jar
Download it and you put it in a place like C:\cgoban\

Then just run :

Code: Select all

"C:\Program Files\Java\jre6\bin\java.exe" -jar C:\cgoban\cgoban.jar

Cgoban should open right away. Connect to your accound and make a demo game, click on the board and you should have sound.

After that, you can make a batch file of the previous command line to make it easier.


edith: I just tested this on ArchLinux and it didn't work with 'java version 1.6.0_20'...
Last edited by BadPotato on Sun Jan 08, 2012 9:16 am, edited 1 time in total.
nukeu666
Dies in gote
Posts: 25
Joined: Thu Dec 15, 2011 7:05 am
Rank: 7k KGS
GD Posts: 0
KGS: herpderp
Universal go server handle: nukeu666
Online playing schedule: All day
Location: India
Has thanked: 6 times
Been thanked: 2 times

Re: stone clicking sound missing - windows 7

Post by nukeu666 »

I'm quite sure i lost the stone click sound when the client was upgraded to 3.5.4
Itaris
Beginner
Posts: 2
Joined: Sat Mar 31, 2012 3:18 am
GD Posts: 0

Re: stone clicking sound missing - windows 7

Post by Itaris »

I have the same problem (Windows Vista and JDK 7u3 and 6u31). In the past I had no problems, but now the only solution seems to be to switch to another server like Tygem.
Mef
Lives in sente
Posts: 852
Joined: Fri Apr 23, 2010 8:34 am
Rank: KGS [-]
GD Posts: 428
Location: Central Coast
Has thanked: 201 times
Been thanked: 333 times

Re: stone clicking sound missing - windows 7

Post by Mef »

I personally haven't had any real issues with KGS sound (though I have XP, Java 6_30, and 90% of the time I have it on mute anyway) but from trying to help a lot of windows 7 users troubleshoot, there is an issue with Java7 and KGS sound, rolling back to Java 6 should fix the issue (at least most of the time...perhaps it was java 6 update 31 where it broke). Linux I'm not as sure about since I don't have a computer running linux right now, but there's another thread where some workarounds have been posted for linux.
phew
Beginner
Posts: 2
Joined: Sat Apr 28, 2012 10:48 pm
GD Posts: 0
KGS: phong

Re: stone clicking sound missing - windows 7

Post by phew »

Same problem here.

JRE 1.6.0_32-b05
Windows 7 x86

I tried to uninstall JRE, and remove related folders and registry entries as much as posible, and then reboot OS and re-install with offline installer, but still no sound when putting a stone on to the board.

I tested Normal jnlp installation, KGS web site with firefox, and cgoban.jar on my HD, but all same results.

If someone got over this problem, please tell us how!!
Nick23
Beginner
Posts: 4
Joined: Mon Apr 30, 2012 7:47 am
Rank: KGS 1d
GD Posts: 0
KGS: Nick23
Has thanked: 4 times
Been thanked: 11 times

Re: stone clicking sound missing - windows 7

Post by Nick23 »

I've been working on this today and think I may know what the problem is. It would be extremely helpful if the people who have the no stone clicks problem could run the attached test program and post the output here.

Download the attached zip file, open a command prompt, and then run
java -jar testaudio.zip
You should hear a stone click or see an error message. If we get several people to post their outputs we can confirm my guess. Please also post the output of
java -version

/* Copyright disclaimer
*
* This troubleshooting code copies parts of cgoban 3.5.10 at http://gokgs.com/
* which was reverse engineered to help find the cause of a problem with sounds not playing
*
* IANAL. It is my good faith belief that
* 1. The copied portions are too trivial to be copyrightable under United States law and international IP treaties
* 2. Use of reverse engineering for interoperability is expressly permitted under these laws
*
* Nevertheless, I do not wish to grieve William Shubert, creator of cgoban.
* Therefore, I will take this down upon his request.
*
*/
Attachments
testaudio.zip
Test program to detect cause of missing stone click sound.
(6.75 KiB) Downloaded 1212 times
Last edited by Nick23 on Mon Apr 30, 2012 7:52 pm, edited 1 time in total.
Slarty
Beginner
Posts: 3
Joined: Mon Apr 30, 2012 9:08 am
Rank: 3d
GD Posts: 2
KGS: Slarty
IGS: Slarty
OGS: claritywhisk
Been thanked: 1 time

Re: stone clicking sound missing - windows 7

Post by Slarty »

Here's my output. I *think* I've had this problem longer than Java 1.7 has been around.

C:\...>java -jar testaudio.zip
Unable to open Java mixer.
You have the following mixers available:
Primary Sound Driver
Speakers (SigmaTel High Definition Audio CODEC)
Primary Sound Capture Driver
Microphone (Webcam C160)
Microphone (SigmaTel High Defin
Port Speakers (SigmaTel High Definit
Port Microphone (SigmaTel High Defin
Port Microphone (Webcam C160)
Played audio file at volume 0.0

C:\...>java -version
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) Client VM (build 21.0-b17, mixed mode, sharing)
hermitek
Dies in gote
Posts: 27
Joined: Tue Jan 25, 2011 3:25 am
Rank: KGS 5k
GD Posts: 0
Has thanked: 14 times
Been thanked: 3 times

Re: stone clicking sound missing - windows 7

Post by hermitek »

64bit linux with alsa, no pulseaudio:

Icedtea 6: (stone placing) sound doesn't work

Code: Select all

java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.1) (Gentoo build 1.6.0_24-b24)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

Exception in thread "main" java.lang.UnsupportedClassVersionError: Main : Unsupported major.minor version 51.0
   at java.lang.ClassLoader.defineClass1(Native Method)
   at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
   at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
   at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
   at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
   at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: Main. Program will exit.

Icedtea 7: sound doesn't work

Code: Select all

java version "1.7.0_03-icedtea"
OpenJDK Runtime Environment (IcedTea7 2.1) (Gentoo build 1.7.0_03-icedtea-b147)
OpenJDK 64-Bit Server VM (build 22.0-b10, mixed mode)

Unable to open Java mixer.
You have the following mixers available:
  PCH [default]
  PCH [plughw:0,0]
  PCH [plughw:0,1]
  PCH [plughw:0,2]
  Generic [plughw:1,3]
  Port PCH [hw:0]
  Port Generic [hw:1]
Played audio file at volume 0.0


Oracle Java 1.7: sound doesn't work

Code: Select all

java version "1.7.0_03"
Java(TM) SE Runtime Environment (build 1.7.0_03-b04)
Java HotSpot(TM) 64-Bit Server VM (build 22.1-b02, mixed mode)

Unable to open Java mixer.
You have the following mixers available:
  PCH [default]
  PCH [plughw:0,0]
  PCH [plughw:0,1]
  PCH [plughw:0,2]
  Generic [plughw:1,3]
  Port PCH [hw:0]
  Port Generic [hw:1]
Played audio file at volume 0.0


Sun Java 1.6: sound works (but java prevents other applications from using the sound card)

Code: Select all

java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)

Exception in thread "main" java.lang.UnsupportedClassVersionError: Main : Unsupported major.minor version 51.0
   at java.lang.ClassLoader.defineClass1(Native Method)
   at java.lang.ClassLoader.defineClassCond(Unknown Source)
   at java.lang.ClassLoader.defineClass(Unknown Source)
   at java.security.SecureClassLoader.defineClass(Unknown Source)
   at java.net.URLClassLoader.defineClass(Unknown Source)
   at java.net.URLClassLoader.access$000(Unknown Source)
   at java.net.URLClassLoader$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: Main. Program will exit.

Nick23
Beginner
Posts: 4
Joined: Mon Apr 30, 2012 7:47 am
Rank: KGS 1d
GD Posts: 0
KGS: Nick23
Has thanked: 4 times
Been thanked: 11 times

Re: stone clicking sound missing - windows 7

Post by Nick23 »

Could you download and run it again? I did not realize that compiling with Java 1.7 would mean it does not run in Java 1.6. I have now compiled it with java 1.6.
witwit
Beginner
Posts: 8
Joined: Tue Jun 22, 2010 4:50 pm
Rank: KGS 7K
GD Posts: 12
KGS: witwit
Has thanked: 1 time
Been thanked: 2 times

Re: stone clicking sound missing - windows 7

Post by witwit »

I tried the command as you said. The output indicated it worked but there was no sound produced.

Code: Select all

Played audio file at volume 0.85125035

java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)
hermitek
Dies in gote
Posts: 27
Joined: Tue Jan 25, 2011 3:25 am
Rank: KGS 5k
GD Posts: 0
Has thanked: 14 times
Been thanked: 3 times

Re: stone clicking sound missing - windows 7

Post by hermitek »

Icedtea 6: Unable to open Java mixer.
Sun Java 1.6: Played audio file at volume 0.85125035
Nick23
Beginner
Posts: 4
Joined: Mon Apr 30, 2012 7:47 am
Rank: KGS 1d
GD Posts: 0
KGS: Nick23
Has thanked: 4 times
Been thanked: 11 times

Re: stone clicking sound missing - windows 7

Post by Nick23 »

Thanks for posting your outputs everyone. Here is what I think is going on with the missing stone click sounds (sorry about all the technical terms).

1. Most sounds on KGS are played using the Applet.newAudioClip API. How this API works, I don't exactly know, but you do not need to specify a "mixer".

2. AutoMatchStart.wav and Stone.Wav are played using the javax.sound.sampled API. For this API you need a "mixer".

3. Oracle includes a mixer called "Java Sound Audio Engine" that is supposed to be always available.
CGoban's code specifically requests this mixer (probably because it is always available). This mixer no longer exists in Java 1.7. So for all the people with Java 1.7 it fails as soon as it requests that mixer. This mixer also does not exist in Icedtea/OpenJDK.

4. The "Java Sound Audio Engine" in Sun/Oracle 1.6 does exist. However, it apparently tries to lock the sound card for itself in some cases. That means that if you have other applications using sound, stone clicks won't play.

As to how to solve this problem, I can think of three solutions.

A) Request a line directly from AudioSystem, without specifying a mixer. I do not recommend this as on my system sound got really choppy when I tried this.

B) Always request the first mixer (ainfo[0]). From the available mixer lists people have posted so far, the first mixer appears to always be the one you want. One problem is that this mixer may or may not support the MASTER_GAIN control. If it does not, trying to instantiate that throws an exception.

C) Migrate these two sounds to use the same API as the rest of the sounds: Applet.newAudioClip

Hopefully a solution can be implemented in the next version of KGS.

Unfortunately, until then, for us users there is nothing we can do. We cannot make the "Java Audio Sound Engine" mixer magically reappear except by downgrading to a version where it existed.
User avatar
SpongeBob
Lives in gote
Posts: 499
Joined: Sat Apr 24, 2010 3:18 pm
Rank: Fox 3D
GD Posts: 325
Location: Germany
Has thanked: 213 times
Been thanked: 96 times

Re: stone clicking sound missing - windows 7

Post by SpongeBob »

So what's Oracle doing here? Aren't they long enough in the software business to know that language updates should stay compatible?
Stay out of my territory! (W. White, aka Heisenberg)
Nick23
Beginner
Posts: 4
Joined: Mon Apr 30, 2012 7:47 am
Rank: KGS 1d
GD Posts: 0
KGS: Nick23
Has thanked: 4 times
Been thanked: 11 times

Re: stone clicking sound missing - windows 7

Post by Nick23 »

Well, WMS has replied to my email saying that unfortunately he cannot spend time to fix this in cgoban.

So, I programmed an extension to java itself to make KGS audio work again (it implements the mixer that cgoban is looking for, and just passes everything through to another mixer).

Warning: THIS IS A HUGE UGLY HACK. IF YOU IMPLEMENT THIS WORKAROUND IT COULD MEAN OTHER JAVA APPLICATIONS CANNOT PLAY SOUND OR WORSE COMPLETELY STOP WORKING. IT MAY OPEN YOU TO SECURITY VULNERABILITIES OR OTHERWISE CAUSE YOU HARM. IT IS NOT AT ALL GUARANTEED TO WORK FOR YOU. YOU HAVE BEEN WARNED. USE AT YOUR OWN RISK.

All I can say is that it has solved the problem for me.

How to implement? First, open the zip file and look through the source code for any malware or security vulnerabilties. If you are satisfied, and willing to use this at your own risk, rename the file to .jar and place it under lib/ext in your java home directory. For me this was /usr/lib/jvm/jre/lib/ext. For you it may be C:\Program Files\Oracle\Java1.7.0\lib\ext.

After that, you should be able to hear stone click sounds on KGS. Please let me know if you experience any problems. I expect there will be bugs at first, and I can only fix them if you tell me about them.
Attachments
javadummymixer_biguglyhack.zip
A big fat ugly hack to enable CGoban to play stone click sounds.
(12.97 KiB) Downloaded 5071 times
User avatar
UnclMartin
Dies in gote
Posts: 55
Joined: Sat Oct 29, 2011 1:44 pm
GD Posts: 0
KGS: UnclMartin
Has thanked: 6 times
Been thanked: 12 times

Re: stone clicking sound missing - windows 7

Post by UnclMartin »

Here is a solution that comes to us via email that should work for the Java Web Start client (but not the applet):

Edit the shortcut or command that starts CGoban and add
-J-Dsun.sound.useNewAudioEngine="false"
after javaws.

For example, if your command was javaws cgoban.jnlp change it to javaws -J-Dsun.sound.useNewAudioEngine="false" cgoban.jnlp


Some of you please try this, and post the results here.

For those of you who use the "java" command instead of the "javaws", remove the "-J" For example,
java -Dsun.sound.useNewAudioEngine="false" -jar cgoban.jar

Thank you, person that sent the email.
(I guess he wishes to remain anonymous, since he did not post that here himself.)

Edit 25 October, 2012: The admins have been told that the switch to use the old audio engine is only for Java 1.6.0_30 to 1.6.0_43. It is not available in Java 1.7, and Java older than 1.6.0_30.
Last edited by UnclMartin on Wed Nov 27, 2013 12:34 am, edited 2 times in total.
Post Reply