views:

2173

answers:

5

Hello,

I am trying to play music from the user's music library and at the same time record from the built-in microphone. However, as soon as I start recording from the microphone it automatically pauses the music, and I can't find any way to play music and record at the same time. I am using the MediaPlayer framework to play music and the AudioToolbox framework to record from the mic.

Does anyone know if it is possible to play music and record from the mic at the same time, and if so how to do it?

A: 

I have never used your two programs, but I did use audacity to capture sounds from the internal mic and it was very easy. Audacity is a great program overall, and it allows you to easily select your inputs such as internal microphone and outputs plus has a whole array of mixing options. Best I can do hope it helps!

P.S- this link might help, especially if you want to use internal mic and real mic at same time: http://torley.com/how-to-record-mic-and-speakers-on-vista-with-realtek

Javed Ahamed
A: 

Sorry, I forgot to mention that I am talking about a program I'm writing for iPhone, not a computer. (How could I miss that??)

Edit this into the original post and delete the answer.
Hooked
A: 

You'll need to set your audiosession properties to allow both recording and playback. This might mean that you need to use AudioToolbox for the playback as well as the recording.

Mark Bessey
+2  A: 

You set your audio session to kAudioSessionCategory_PlayAndRecord
and create an in/out remote io audio unit.

The "loopy" author talks about how to do this here and provides code.
The trailblazing tones of the article are slightly dated now.

Rhythmic Fistman
A: 

Thanks guys! I will try setting the audio session to kAudioSessionCategory_PlayAndRecord.