Platforms to show: All Mac Windows Linux Cross-Platform

NSSoundMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class Cocoa MBS MacBase Plugin 9.4 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
The NSSound class provides a simple interface for loading and playing audio files.

This class supports the same audio encodings and file formats that are supported by Core Audio and QuickTime.

To use this class, initialize a new instance with the desired file or audio data. You can configure assorted aspects of the audio playback, including the volume and whether the sound loops before you play it. Depending on the type of the audio data, this class may use either Core Audio or QuickTime to handle the actual playback. (Typically, it uses Core Audio to play files in the AIFF, WAVE, NeXT, SD2, AU, and MP3 formats and may use it for other formats in the future as well.) Playback occurs asynchronously so that your application can continue doing work.

You should retain NSSound objects before initiating playback or make sure you have a strong reference to them in a garbage-collected environment. Upon deallocation, a sound object stops playback of the sound (as needed) so that it can free up the corresponding audio resources. If you want to deallocate a sound object immediately after playback, assign a delegate and use the sound:didFinishPlaying: method to deallocate it.

If you want to play the system beep sound, use the NSBeep function.

This class has no sub classes.

Some events using this class:

Blog Entries


The items on this page are in the following plugins: MBS MacBase Plugin.


NSSoundDelegateMBS   -   NSSpeechRecognizerMBS


The biggest plugin in space...