The Minim Library adds sound playback, input, analysis, and synthesis for Processing. It can play sound effects and background music, play AIFF, WAV, OGG, or MP3 files, do sound input and FFT analysis, and synthesize and filter sounds.

There are a bunch of examples that come with Processing; check those out, and the documentation here: