processing play sound

Java
import processing.sound.*;

SoundFile sound;

void setup()
{
  sound = new SoundFile(this, "sound.wav"); //add audio files
}

void draw()
{
  if(playSound)
  {
    sound.Play(); //play audio
  }
}
Source

Also in Java: