Playback and Recording simultaneously using Core Audio in iOS - iphone

I need to play and record simultaneously using Core Audio. I really do not want to use AVFoundation API (AVAudioPlayer + AVAudioRecorder) to do this as I am making a music app and cannot have any latency issues.
I've looked at the following source code from Apple:
aurioTouch
MixerHost
I've already looked into the following posts:
iOS: Sample code for simultaneous record and playback
Record and play audio Simultaneously
I am still not clear on how I can do playback and record the same thing simultaneously using Core Audio. Any pointers towards how I can achieve this will be greatly appreciable. Any pointers to any sample source code will also be of great help.

The RemoteIO Audio Unit can be used for simultaneous record and play. There are plenty of examples of recording using RemoteIO (aurioTouch) and playing using RemoteIO. Just enable both unit input and unit output, and handle both buffer callbacks. See an example here

Related

Audio Recording on iOS

I've just started working on a project that requires me to do lots of audio related stuff on iOS.
This is the first time I'm working in the realm of audio, and have absolutely no idea how to go about it. So, I googled for documents, and was mostly relying on Apple docs. Firstly, I must mention that the documents are extremely confusing, and often, misleading.
Anyways, to test a recording, I used AVAudioSession and AVAudioRecorder. From what I understand, these are okay for simple recording and playback. So, here are a couple of questions I have regarding doing anything more complex:
If I wish to do any real-time processing with the audio, while recording is in progress, do I need to use Audio Queue services?
What other options do I have apart from Audio Queue Services?
What are Audio Units?
I actually got Apple's Audio Queue Services programming guide, and started writing an audio queue for recording. The "diagram" on their audio queue services guide (pg. 19 of the PDF) shows recording being done using an AAC codec. However, after some frustration and wasting a lot of time, I found out that AAC recording is not available on iOS - "Core Audio Essentials", section "Core Audio Plug-ins: Audio Units and Codecs".
Which brings me to my another two question:
What's a suitable format for recording, given Apple Lossless, iLBC, IMA/ADPCM, Linear PCM, uLaw/aLaw? Is there some chart somewhere that someone might be able to refer to?
Also, if MPEG4AAC (.m4a) recording is not available using an audio queue, how is it that I can record an MPEG4AAC (.m4a) using AVAudioRecorder?!
Super thanks a ton in advance for helping me out on this. I'll super appreciate any links, directions and/or words of wisdom.
Thanks again and cheers!
For your first question, Audio Queue services or using the RemoteIO Audio Unit are the appropriate APIs for real-time audio processing, with RemoteIO allowing lower and more deterministic latency, but with stricter real-time requirements than Audio Queues.
For creating aac recordings, one possibility is to record to raw linear PCM audio, then later use AV file services to convert buffered raw audio into your desired compressed format.

How to play record the sound programmatically and how to play that recorded audio?

I am developing one application. In that I want to record the sounds and I want to play that recorded sound file. I know the frameworks for doing this. But how to develop programmatically by using that frameworks?
You can refer to this link:
I have implemented this code in one of my apps and it works completely fine.
How do I record audio on iPhone with AVAudioRecorder?
For Playing the sound you have option to use AVAudioRecorder.
Hope this helps.
The best way to do it - and I am talking from painful experience here - is with the RemoteIO audio unit. You can also do it with AudioQueue, but it has a higher latency, and the queue type approach becomes very problematic.
So, I think that they are really different tools for different jobs. Note that you won't play a sound file as such. You will play the contents of a buffer held in memory. As long as the buffer is not too large, this should not be an issue.
So, going with RemoteIO, you will find this blog and tutorial very useful. It includes code samples.
Using RemoteIO audio unit By MICHAEL TYSON

Record and play using Audio Queues in iPhone

Can someone explain how we can use Audio Queue services to record sound from Microphone and play it live? Explain how we can achieve it. If possible give code snippets.
Use RemoteIO Audio Unit. This awesome code will get you on the right path.

Is there another API that will enable real-time audio processing on iOS?

I was hoping to make an application that did real time voice manipulation like the the T-Pain App. But AVAudioRecorder only enables a post processing from of audio manipulation. Is there another API that will enable real-time audio processing?
thanks!
The iOS Audio Unit RemoteIO API allows for very low latency audio recording and playback, and the raw audio sample buffers are available for modification in between the audio record and play buffer callbacks.
See Apple's aurioTouch sample app for example source code.

Accessing audio samples on the iPhone

I want to code up a audio fx program that would process the samples coming in through the mic input and play them through the audio output in near realtime. But I cannot seem to figure out how to get accesses to the individual audio samples as they come in. Can. Anybody point me in the right direction and possibly some sample code? Thanks.
The audio-processing framework in iOS is called Core Audio. See the Core Audio Overview. For sample code see the iOS Reference Library sample code. You can filter for audio using the searchbox
You probably want to be looking at the Audio Queue services (most/all of the function names begin with "AudioQueue").