Playing a movie file and then various audio files while movie is playing back. (iOS) - iphone

Is it possible to play some audio files while my movie is playing. I don't want it to interrupt or pause he movie. Just the audio to play at same time at various predetermined points.
Many Thanks,
-Code

You shouldn't have any problems with it.
If you want to synchronize or delay these players you should use
the code they provide in AvAudioPlayer Class Reference using
playAtTime: method.
Sadly MPMediaPlayback protocol doesn't provide the same method
so exact synchronizing with video is a bit harder task.
EDIT: RoLYroLLs mentions using MPMoviePlayerLoadStateDidChangeNotification to achieve this here and this approach seems promising.

Use two or three Audioplayer at same time . Play that audio when u need it

Related

playing multiple sounds(mp3, wav etc) in an iOS app

This is my requirement. I have set of audio files(mp3, wav mostly). My app's interface will have a list of these sound names and a toggle ON/OFF switch for each of the sound item. On switching a sound ON it should start playing and vice versa. If more than one sound is ON then they should be played simultaneously. I can switch any sound ON/OFF while the sound is playing and it should switch off instantly.
What classes are best suggested for this behavior ? Do I need to mix the sounds etc or just instantiate multiple AVAudioPlayer instances ???
Please guide me in making an efficient app.
Thanks!
Use different instance of AVAudioPlayer for playing simultaneously.
Now maintain list of AVAudioPlayer instance into NSMutableArray depending on state ON/OFF. if state ON then play audio add AVAudioPlayer instance in array and if state OFF then stop audio remove AVAudioPlayer instance from array.
You can user openAL to do your task. Here is the link to get it https://github.com/kstenerud/ObjectAL-for-iPhone .

Combine two audio files together and play them in iPhone

I do not want any code but want to get a reference about my question mentioned below...
There is background music available and there is recording option in my app...
Once I start recording , application records my sound and when play button clicks , It will play the recording along with the background music...
I had use this Link but can not get as I want...
I think there is a mechanism like merging two audio files and make it one before playing....
How can I achieve this by coding... Is there any reference link or any sample code available?
Thnx in advance...
Most people mistake the one instance of AVAudioPlayer as the unit that plays the sound directly, but it doesnt. Mixing is done by the OS, not by the instance of AVAudioPlayer.
With other words:
No one says you can't have more then one AVAudioPlayer.
Create one for you background and let it play. Create another instance of AVAudioPlayer for you recorded sound and let it play. Voila

How to use AVAudioPlayer to play a playlist in iPhone/iPad

Please I know how to play a sound in AVAudioPlayer but I would like to know how to give it a list of on-disk files to play one after the other (play list)
Anyone has any idea?
You have to manage this by yourself, using the 'audioPlayerDidFinishPlaying' method to know when the current song is over, and when to start a new one.
The Apple "AddMusic" sample program does exactly this, setting up a playlist of audio files using MPMusicPlayerController and AVAudioPlayer to do most of the work.

OpenAL doesn't work when using AVAudioRecorder and AVAudioPlayer

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?

How can Play Audio file in loop without any interruption?

I am trying to develop a simple iPhone app. I need to play sound within a loop.
How can Play Audio file in loop without any interruption ?
Take a look at the new AVAudioPlayer class in the 2.2 release:
http://developer.apple.com/iphone/library/documentation/AVFoundation/Reference/AVAudioPlayerClassReference/Reference/Reference.html
It has functionality for looping sounds.
I really don't know the iPhone SDK at all, but this should be quick: try making the sound itself looping. That way, you should be able to play it with just a single call, and won't need to worry about timing the repeat properly to restart it at the exact right moment.
For instance, WAV files have very flexible support for looping, and any decent audio editor should let you set looping points.
The AVAudioPlayer has numberOfLoops property where you can specify the number of times you want the audio to loop.