In my iPhone application I need to play custom sound while vibration.
I have found here: http://gregheo.com/blog/simple-audio/ that I should use AVAudioPlayer. But how can I play system sound of vibration using AVAudioPlayer? If there is another way to play custom sound and vibration together?
Update
I have found that I can use AVAudioPlayer to play custom sound and Audiosession to play vibro system sound. But maybe someone can advise me a better solution?
This SO post seems to deal with the exact opposite of your issue so it might give you the answer you are looking for:
How to play system sound on iOS without vibration?
Related
I'm currently using AudioServicesPlaySystemSound(_soundID) to play sound clips. My understanding is that this can only be used to play clips under 30 seconds.
What is the standard way of playing longer sound clips?
AVAudioPlayer
is there any way to play a short sound and let the phone vibrate at the same time?
I found something about AudioQueing, but I'm a newbie and cant wrap my head around that whole process of AudioQueing.
Kind regards from Germany
Yes. What part do you have problems with? Playing sounds, vibrating, or doing both at once? For playing short sounds you can use the AVAudioPlayer class. The vibration is triggered by the following code:
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
Described here, for example.
i have been troubled about audio problem for several days. i don't think OpenAL get along with AVAudio functions.
i have my own OpenAL class. ( wrapped the MyOpenAL class )
my app start to record using AVAudioRecorder. i stop recording. and then i clicked the "OpenAL Play"button that play any sound using OpenAL.
i can't hear it.
but i can hear my recording when i clicked the "AVAudioPlayer Play" button using AVAudioPlayer.
i tested oalTouch,avTouch,SpeakHear sample code.
they resulted same.
in oalTouch, when AVAudioPlayer stop, OpenAL stop playing simultaneously. this is why i think so.
Does OpenAL have the problem using AVAudio~ Functions together?
I was googling for a long time. but i couln't find out the solutions and the same problems issue.
thanks for reading mine.
I'm using AVAudioRecorder (to record) and OpenAL (to playback) and they both go quite well. Just wanted to check if you use Play_And_Record as option when you initialize your AVAudioRecorder?
I am wondering if there is some way to fade in and out audio using AVAudioPlayer in CocoaTouch, with a pause command once the music finishes fading and then a play command once the fading begins. I have heard that one can use NSTimer for this purpose, but I am unsure of the easiest way to accomplish this.
Thanks for any help!
There is a good video tutorial to do this here: Playing a sound, and fading a sound using AVAudioPlayer on iPhone.
Duplicate:
use more then one sound in my iphone application using cocos2d
Hi,
All of the member of this forums.I need to help yours for doing my game project.I want to play some sound in my gaming project.When this game is started a background sound is playing continuously until the game is stop (exit). When game is played that time some action button are work and every action one sound is play for few second but background sound did not stop that time. How can i do this if anyone have a solution than reply with answer please.
If you are using cocos2d 0.82, then you can use denshion for this.
Play background music:
[[SimpleAudioEngine sharedEngine] playBackgroundMusic:#"somemusic.mp3"];
Play SOUND EFFECT:
[[SimpleAudioEngine sharedEngine] playEffect:#"mysound.wav"]
You can find this and more at http://www.cocos2d-iphone.org/wiki/doku.php/cocosdenshion:cookbook
You could, if you implemented your own mixer. Just playback a buffer and mix the audio yourself. It' basically boils down to just averaging two different amplitudes. In some cases it's a bit more advanced.
Check out the AVAudioPlayer class. It will do what you need.
One thing to be aware of is that this class will only play one mp3 format sound at one time. I suggest converting to IMA4 format if you are using mp3 and need to play multiple sounds at once.
You can use the afconvert command to convert between sound file formats.
AVAudioPlayer is available in firmware 2.2+.