import java.applet.*;
import java.net.*;

//Supported formats: AIFF, AU and WAV.
//Must be 8 or 16 bit with sample rates from 8KHz to 48KHz.
//If not supported, the sound just won't play, but no error occurs.
//I recommend downloading and using Audacity to convert sounds.
//In Audacity, there's a drop down on the left side of each sound that lets you convert to 16 bit, and you can export as WAV.
public class Sound
{
  public static void main(String[] args)
  {
    play("gobble.wav");
  }

  public static void play(String fileName)
  {
    URL url = Sound.class.getResource(fileName);
    if (url == null)
      throw new RuntimeException("cannot find file:  " + fileName);
    Applet.newAudioClip(url).play();
  }
}
