Be sure to read the sound articles over at MacEdition, The machine that goes ping and Sound-off, Part 2
CocoaSound shows playing of sound via theNSSound class
Download CocoaSound Pröject (with source), 8K (tar.gz format)
QTMp3 shows playing mp3s in a Cocoa application by using QuickTime.
Download QTMp3 Pröject (with source), 7K (tar.gz format)
Volumator shows getting and setting the volume using MTCoreAudio.framework (so you'll need to download that first)
Download Volumator Pröject (with source), 5K (tar.gz format)
Recordotron reads data from the default input device, and later plays it to the default output device, allowing recording and playback. This uses the MTCoreAudio.framework (so you'll need to download that first)
Download Recordotron Pröject (with source), 8K (tar.gz format)