Sunday, July 16, 2006

Decent Sound on KGS with cgoban2

The two things that have bothered me most about KGS are both related to the cgoban2 java client program: sound and graphics. Considering that go is such a beautiful game played on equipment unmatched (IMO, of course!) by any other game for its aesthetic value, it always stuck me as odd that I'd be clicking down virtual stones on a drab lifeless board with dull thunks.

For reasons unfathomable to me as a programmer (considering that there is such a broad user support base around the application), the author of KGS has decided that there will be no graphical or sound-related options. So, I decided to take a closer look at the jar file in hopes of finding a simple structure of sounds and graphics which I could then replace at will.

Well, one fix is better than none...sounds are clearly to be seen inside the jar structure. Board and stone graphics are not, so I am guessing that they are embedded xpm code inside the class files. :( Oh, well. At any rate, after a bit of trial and error, I have changed the stone placement sound! If you are interested, here is a brief step-by-step.

Prework:

  • Find a stone sound you like. Personally, I love the stone click sound from MultiGo (beware, Windows only). Any wav file (or 8-bit u-law sun audio file, I think) should do just fine.
  • Make a copy of your cgoban.jar file for safe keeping. If you break anything, you can simply copy it back. For unix people, I assume you know where you installed the cgoban directory. For Windows users, check out C:\Program Files\kiseido\cgoban. The cgoban.jar is right in there.
  • Make a temporary directory and copy cgoban.jar into it.


Steps:

  • Open up a terminal window (or command prompt for Windows users) and navigate to your temp directory.
  • "unjar" the cgoban.jar file with the command:

    jar xvf cgoban.jar

    This will extract the contents of the jar file.
  • From there, copy your good sound file as:

    org/igoweb/client/swing/sounds/stone.au

    Don't worry if your file is .wav...changing the extension to .au will not hurt anything as java will still be able to open it.
  • Update your cgoban.jar file:

    jar uvf cgoban.jar org/igoweb/client/swing/sounds/stone.au

    This will replace the existing stone.au in the jar file with your new stone.au file.
  • Copy the new cgoban.jar file into place in your cgoban installation directory (where you found it in the first place).


That's it! Hopefully, when you run the app your dull thunk sounds will now be melodious. :)

PS: I would love to simply place an updated jar file here that you could download, but that would probably go against both the cgoban and MultiGo distribution terms. :(

UPDATE:

The BETA of version 3.0 has been released. Unfortunately, it includes no improvements to the graphics or sound. Fortunately, though, this procedure will still work. The only change is that, now, the path for the sound file is:

org/igoweb/igoweb/client/swing/sounds/stone.au

Note the extra "igoweb" directory.

5 comments:

Tabun said...

Great job. Any tips for altering the sound of the webstart Cgoban 3 client?

frankiii said...

The same method works with the cgoban3 client. Have fun!

Tabun said...

Hmm.. Webstart applications seem to work a little differently (here, at least).

The cgoban .jar file is called "RMcgoban.jar" and is located in \Documents and Settings\[user]\Application Data\Sun\Java\Deployment\cache\javaws\http\Dfiles.gokgs.com\p80\DMjavaBin
(wowzers, that is not a pretty locator).

The rest indeed looks to be the same, so from there on I shouldn't have any problems.


Finally, since I'm also of the nitpicky kind, I've made a selection of sounds that appealed to me (even) more than MultiGo's click. Maybe others will find a use for them too, so here they are:

www.tabun.nl/tmp/go/go_sounds.zip

Thanks and have fun, too. :]

Tabun said...

Oops, sorry. I messed up the url. Sounds are not at the location indicated above, but here: www.tabun.nl/tools/go/go_sounds.zip.

Jade Graham said...

I decided to take a closer look at the jar file in hopes of finding a simple structure of sounds and graphics which I could then replace at will. window graphics Chicago