views:

564

answers:

2

Is it possible to easily play a tone, or series of tones on the iPhone (like morse code, beep beeeeeep beep)?

Is there any sample code out there that would point me in the right direction?

(I remember on the Commodore 64 it was about 4 lines of code !)

+1  A: 
  1. Think different. Use an audio file. :) Lots of easy ways to play those.

  2. Look at the AudioQueue library in AudioToolbox.framework. AudioQueueNewOutput might be what you're looking for, though I haven't used these in a while. You can provide your audio data in the callback.

Andrew Pouliot
+1  A: 

You can use:

#import <AudioToolbox/AudioToolbox.h>
AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);

I'm pretty sure that do what you want it to do just fine. MAKE SURE you link to the AudioToolbox framework first!

micmoo