how to play background music while recording voice? - iphone

friends
Now I'm developing iPhone Recorder App.
I can easily record my voice with sample code.
I want to record background music with my voice.
For example,When I click "Record" button,background music plays
Then I sing a song.
In this case,I should record background music with my voice.
But,If I did like that,I can't record anything.
What's wrong?
To do this,what should I do?
Please help me..
Thanks.

I'm not familiar with programming for the iPhone but I can imagine there would be a limitation to what you like to achieve IF you intend to make this work without using headphones/headset. It just might be that the OS wont let you play music and record at the same time because the recording would result in an echo because of the background music.
That said, I'm sure an experienced iPhone programmer is able to tell you exactly how this would work.
Good luck and I hope my suggestion helps you out.

friends
I solved this problem by using OpenAL.
Thanks for all your effet.

Related

Audio in Background in iphone

I want to make an app which can play audio in background in iphone.Is there any tutorial or example available?
There are plenty out there! Google is your friend :)
http://developer.apple.com/library/ios/#documentation/Audio/Conceptual/AudioSessionProgrammingGuide/Cookbook/Cookbook.html#//apple_ref/doc/uid/TP40007875-CH6-SW1

How to allow ipod music to play while my app is running?

I'm using SimpleAudioEngine to play my sounds and I was wondering if there is anyway to check if iPod music is playing when the app is launched. If so, I want it to continue playing. I'm starting to think it may be called the simple engine for a reason as it doesn't allow features like this, where AVAudioEngine does...
Thanks :)
You should check out the official Audio Session Programming Guide and make sure that you are setting the correct session category. You will want to pick the category that allows your audio to mix with the iPod audio.

iPhone (iOS4): is it possible to play music/sound during an active call?

I want to allow user to switch to my app during a phone call and play some sound that the second person will hear.
I see here that it was possible even before iOS4 and here that no one knows how to do it.
I will really appreciate if someone will spread some light on this issue.
Thank you.
If you would like to play a song and after launch a phone call, any iPhone OS will stop your song, just beacause phone call has privilege over audio playback.
What you can do is play a song after the call has started, but in this case you can only use speakers.
I've tried the second, and with great audio tracks and some simple advises, you can reach the desired effect.
You could achieve it using Twilio API

Recording sounds created within an iPhone app

I'm new to programming in Objective-c and the iPhone but I am working on an app to teach myself. I have been trying to figure out how to record sounds on the iPhone. Apple provides excellent documentation for recording from the microphone with AVAudioRecorder but I want to record sounds made by my app, or even just record sounds when buttons are pressed (button is pressed, certain audio gets recorded).
I have no clue how to do this and can't seem to find anything that would help me along this path, only microphone stuff.
Can anyone share ideas or code that would make this possible?
Thanks
Once you move beyond the convenience classes like AVAudioRecorder, you've got a lot of studying to do.
I would start with:
Getting Started with Audio and Video
Multimedia Programming Guide:Audio
Core Audio Overview
Audio programming is a very large and complex subject. If you want to customize, be prepared to spend some time learning it.
I've made a sample app that records sounds/audio and has a playback. Hope this helps! https://github.com/casspangell/AudioMic

Is it possible to both play a sound and record from the microphone at the same time on the iPhone?

I want to both play sound and record sound at the same time on the iPhone.
All the apps which record sound first disable any music playing. However as music would disrupt their purpose I don't know if they're doing this deliberately or whether the iPhone does it automatically when you record from the microphone.
Does anyone have experience with this?
Refer to this page. Good luck!
I've heard something about this on one episode of the mobile orchard podcast - the one with Michael Tyson, the creator of Loopy. During the discussion, Michael explained that he had to include some code to filter out the sounds that were coming in through the microphone in realtime as other sounds were being played on the speaker.
Based on that discussion, it seems entirely possible to both play and record at the same time, but I'm sure you'll have to do your own filtering to avoid recording the sounds your playing.
You can use either a core audio unit or an audio queue, and
you need to make sure that your audio session category is set to kAudioSessionCategory_PlayAndRecord.
Beware that sound output when you use this session is much quieter
than the normal solo session (observed on 3.0).