Sound Programming Topics for Cocoa

Overview of the NSSound Class

The NSSound class makes it extremely simple for Cocoa applications to load and play sound files. Instance methods provide standard transport control so that a sound can be programmatically started, stopped and paused.

The class supports the following file and data formats:

File Formats:

AIFF

WAV

NeXT SND

Data Formats:

16 bit

44.1 Khz

22.05 KHz

Mono

Stereo

You can load audio data into an NSSound object from three sources:

a disk file—using a pathname or URL

network connection—using a URL

the pasteboard

The NSSound class can search for named sound resources in the application’s main bundle as well as two standard file system locations: /Library/Sounds and ~/Library/Sounds.