I need to implement a feature in iOS where in i have to play a song from iTunes playlist on the right channel and metronome on the left channel.
I need help finding out from where to start, and suggestions on how to implement this feature.
I need to implement a feature in iOS where in i have to play a song from iTunes playlist on the right channel and metronome on the left channel.
I need help finding out from where to start, and suggestions on how to implement this feature.
If you play your metronome sound with AVAudioPlayer, you can pan it to one side with the pan property of the player object. However, you'd need to play the iTunes playlist with MPMusicPlayerController, and I don't see a way to pan that. That's probably playing a stereo source, so you'd really want to merge both channels into one, and I don't know if that's possible. If you created the song in the playlist, you could set it up so the audio is all panned to one side in the stereo file, then your app could just play the file as is.
Anyway, you'll need this tip for playing both audio sources at once:
AVAudioPlayer with MPMusicPlayerController
And here are some tips for playing the tempo sound more accurately, based on my experiences with similar functionality:
Why are my audio sounds not playing on time? (if using an NSTimer)
How can I stop AVAudioPlayer from repeating before it reaches the end of my data? (if using AVAudioPlayer's looping functionality, which is more precise)