Yes ! Usually iOS developer uses AVAudioPlayer to play sounds. But AVAudioPlayer takes time to load sound file for the first time.
To load & play sound very quickly, one can go for OpenAL sound. So, here are the steps for that.
1) Create appropriate sound.
2) Import sound into your project.
3) Load the sound & Play.
1) To use OpenAL, It is recommended to use OpenAL. Convert your sound to CAF using following command in terminal.
|
1 |
/usr/bin/afconvert -f caff -d LEI16@44100 someFile.aiff someFile.caf |
It actually means, convert to Little-endian 16-bit format with 44100 sampling rate. ( I found this details from here, All credit goes to them. I posted it here just for keeping the notes. )
2) Open your project & Import the sound.
3) Put following line of code to load the sound.
|
1 2 3 |
NSString* path = [[NSBundle mainBundle] pathForResource:@"wong" ofType:@"caf"]; NSURL * afUrl = [NSURL fileURLWithPath:path]; AudioServicesCreateSystemSoundID((__bridge_retained CFURLRef)afUrl,&soundID); |
4) Put following line to play the sound.
AudioServicesPlaySystemSound (soundID);

Hey! Someone in my Facebook group shared this site with us so I came to look it over. I’m definitely loving the information. I’m bookmarking and will be tweeting this to my followers! Wonderful blog and great style and design.
Thank you for visiting our site.
But i think to do when ever twit over twitter that time please added ‘#’ and ‘@’ tag into twitter like ‘#sugartin’ and ‘@sugartininfo’
we are also here for sharing more knowledge.
For that upcoming post notification please subscribe to out site right hand site option.
Thanks.