Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

iPhone Programming - Making Sounds and Vibrations (Method 1)

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
1,357
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Mar 21, 2011

A Tutorial on The AudioToolkit framework. Teaching you how to play a sound and make a vibration.

Main Code:
-(IBAction)playSound:(id)sender {
SystemSoundID soundID;
NSString *soundFile = [[NSBundle mainBundle] pathForResource:@"YOUR SOUND NAME" ofType:@"YOUR SOUND FILE EXTENSION"];
AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:soundFile], &soundID);
AudioServicesPlaySystemSound(soundID);

AudioServicesPlaySystemSound (kSystemSoundID_Vibrate);
}

New Type Of Tutorials: http://www.youtube.com/watch?v=rIrVVP7TrXM
Next Video: http://www.youtube.com/watch?v=cMndoJcYitM

Freesound: http://www.freesound.org/
SoundsXtras: http://www.soundsxtras.com/
SoundSnap: http://www.soundsnap.com/

Link: http://developer.apple.com/devcenter/ios/index.action
Website: http://failcake.webs.com/
Twitter: http://twitter.com/failcakeapps
Channel: http://youtube.com/milmersxcode

  • likes, 1 dislikes

Link to this comment:

Share to:

Uploader Comments (MilmersXcode)

  • I have no idea what I'm doing wrong. I followed your tutorial exactly, and even added a printf command, and it prints to the console when I click the button, but my sound still doesn't play. WHAT IS WRONG!?

  • @jamesjamesjac It might be a number of reasons. 1:Make sure you have connected the button in IB otherwise it obviously won't work. 2: Make sure you have the sound file imported into your project. 3: Make sure you have typed the right file extension and right file name in the @"" other wise it won't work but will still run fine.

    I know these sound silly but they are easy to miss. Hope it helps and if it doesn't sned me a message and I will try and give further help.

see all

All Comments (3)

Sign In or Sign Up now to post a comment!
  • SHIT YEAH MAN I FUCKING LOVE YOU: ONE THING COULD YOU TACH USE HOW TO MAKE KINDA LOOPS, SO WHEN YOU PRESS THE BUTTON 3 TIME IT DOESNT PLAY THE SOUND 3 TIMES EACH OVER ANOTHER

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more