How to set pan property like AVAudioPlayer in AVPlayer - iphone

I am using AVPlayer to play simultaneously two songs.I have just finished everything using AVPlayer ..now my problem is how to set voice for left and Right ears in AVPlayer.I want same property as AVAudioPlayer's pan property.When we set pan= -0.1 it routes only through Left ear and +1.0 routes to right ear of Headphone.Any help how to do this ?

Please check the documentation of AVAudioPlayer and use the pan property but openAL allows pan, gain, location, and balance, along with effects.
Playing Sounds with Positioning Using OpenAL
To provide full-featured audio playback including stereo positioning, level control, and simultaneous sounds, use OpenAL. See “Playing Sounds with Positioning Using OpenAL.”
and check this link
ObjectAL for iPhone
Hope it helps.

Related

No audio heard unless facing audio source unity

I have a script, to play a sound clip when a footstep is taken. I use events in the animation tab, and when I play the sound, it will only be audible if i am looking at the character, or npc, the audio source is in fact on the character, but i don't know what is causing this.
On your AudioSource, you could play around with the 3D sound settings:

iPhone headphone output - mono control left / right ear

I'm working on an iOS6 and above GPS navigation route creation and following app. At the moment I've integrated the OpenEARS framework to provide text to speech directions to the user.
I have setup an AVAudioSession and overrode the audio category to headphones. I'm looking for some advice in limiting my audio output to the left / right headphone channel depending on what physical direction the user must travel to reach the destination.
This is my first foray into Audio on iOS and am happy to change from OpenEARS if someone has knowledge of completing this with another TTS library.
Thanks, Ben
To anyone it may help in the future...
After spending hours looking at Core Audio and AudioToolbox methods for balancing I stumbled over a pan property within AVAudioPlayer. OpenEARS, and ultimately Flite, TTS systems use the AVAudioPlayer to play the converted audio file. Cheers!
The audio player’s stereo pan position.
#property float pan Discussion By setting this property you can
position a sound in the stereo field. A value of –1.0 is full left,
0.0 is center, and 1.0 is full right.
Availability Available in iOS 4.0 and later. Declared In
AVAudioPlayer.h

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

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

Record video and play video at the same time

I want to play a video (with sound) and record video from the front-facing camera at the same time. The view finder for the camera should appear as a small "picture-in-picture" in the bottom right hand corner of the screen while the movie plays full screen behind it. Is this possible? Is layering the appropriate classes on top of each other possible?
Check out the AVFoundation framework, which is used for much of the audio and video programming in iOS.
In your case you could use an AVPlayer and AVPlayerLayer to play your movie, and an AVCaptureSession, an AVCaptureVideoPreviewLayer, and an AVCaptureMovieFileOutput to record.
If you are familiar with Core Animation, you can set the bounds and add sublayers to AVPlayerLayer and AVCaptureVideoPreviewLayer to achieve you desired interface layout.
These classes are very well documented, and the AVFoundation Programming Guide clearly explains their interaction.
Feel free to comment with any questions.

Play mp3 file smoothly upon dragging a scroll using AVToolbox or openAL

I have been facing this since so many days but I have not reach to any conclusion.
My problem is : I want to play an mp3 file but not simply by clicking on a play button.
It is this way I want to play it.
*There is a slider that I can drag using finger, I want that the mp3 should play with the frequency with which I am dragging the finger (or speed with which I am dragging my finger, so that it will give an effect of fast forwarding (funny type of voice)) or if I drag slider slowyly the output will be slow *
The problem is the output of the sound is not coming out smooth. its very distorted and disturbed voice.
I want the outuput to be smoother.
Please help. Any suggestions please. Presently I am using AVAudioPlayer and passing the time value based upon slider input to play the file. (It does not seems to be feasible though).
I feel that it is possible using openAL only and no other way. Because using openAL we can modify the frequency of the sound file (pitch)
CAN SOME ONE PLEASE REFER ME A LINK TO openAL implementation for iPhone . I have never played a sound file using openAL
Help!!
You won't be able to do it with AVAudioPlayer, as it does not support pitch operations.
You can load and decode the entire track into memory for playback with OpenAL (which supports pitch), or you can do realtime loading/decoding and pitch changing using Audio Units (MUCH lower level, and more complicated, though).