player

Java sound example - how to play a sound file in Java

My Java sound/audio example: I'm working on a simple "meditation" application that plays a sound after a certain period of time (the sound of a gong), so I thought I'd share some source code out here that demonstrates how to play a sound file in a Java application like this.

(Note: I initially found this technique described at JavaWorld.com, but the code below is taken from my project.)

In this case the sound file I'm going to play is an "au" file, but I believe this same technique works with most other sound file types as well.