1

What is the code to play a (one of the) system sound(s)?

Not my own sound file, not an included (in my app) one. A system sound (like Basso, Blow, Bottle, Frog, etc - the .aiff ones).

I found their names to the Link but now I want to play them.

Code snippets like snippet-playing-a-system-sound don't work (I think), because I don't want to include the sounds in my app, since they are already on the device! I just want to use the ones available. But what is their NSURL location (if that is the way)?

Or if the way is like the vibrate "sound" (i.e. AudioServicesPlaySystemSound(kSystemSoundID_Vibrate)) what is the argument for "them"?

(and...This Link is not very helpful). no surprises here.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Gik
  • 528
  • 5
  • 18

1 Answers1

3

Try this:

AudioServicesPlaySystemSound(1003);

For more audio codes have a look into this link: AudioServices

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
abhishekkharwar
  • 3,529
  • 2
  • 18
  • 31
  • That I knew (check the Q again). My problem is to play the (build in) AIFF sounds *not* the .caf ones. And the idea is to (dynamically) find the ones available (look at the http://stackoverflow.com/questions/10949138/sound-picker-list-of-system-sounds code) and give the user the option to play the one he wants. So I want a way to translate/convert/whatever the NSString name of the sound found by the above code snippet (say @"Glass.aiff"), to something (code/number/URL/whatever) and give it to AudioServicesPlaySystemSound, or AudioServicesPlayAlertSound, or any other method to play it. – Gik Oct 29 '12 at 14:37
  • I found this: http://stackoverflow.com/questions/7831671/playing-system-sound-without-importing-your-own/7831768#7831768 that *partially* tackles the problem. But as I stated on the comments there, that still does not answer my question here: How to play (all) 14 (or so) system sounds. – Gik Nov 02 '12 at 14:11