Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS: Is it possible to record from multiple microphones at the same time

All the recent iPhones have 2+ microphones. Is it possible to record from all the microphones at the same time? If this is possible, what is the best iOS audio library for this (AudioKit, EzAudio, AudioUnits, CoreAudio)? There is no mention of this functionality in AudioKit and EzAudio.

like image 867
Artash Avatar asked Oct 16 '19 20:10

Artash


People also ask

Can you use 2 USB microphones at once?

There are times, however, when you need to use two microphones, such as when you want to pick up two different people at the same time. One would think that you could simply plug in another USB microphone and start your program. The truth is, that simply will not work because the computer gets confused.


2 Answers

I don't see anything in the documentation about multi-mic audio capture being possible. They specify that you can choose a specific microphone but not that you can select more than one simultaneously. AVAudioSession is also a singleton.

Seemingly, at least as of iOS 10, AVCaptureSession also only allows one audio or video input concurrently.

like image 137
Dare Avatar answered Oct 27 '22 04:10

Dare


Since, you can record stereo audio, you can definitely record from multiple microphones at once. Furthermore, since noise cancellation is likely using the 1+ microphones not participating in the stereo recording, it is likely “recording” or at least using all microphones at once.

However, I think the main crux of the questions is if we can get the audio input of each microphone separately at the same time. As Dare points out, the standard API does not support that.

However, assuming there is a one-to-one mapping from microphone source (eg top/bottom) to audio channel (left/right), a theoretical solutions exists…

Simply record in stereo, then separate out the left/right channels, and viola, you can grab the input from each microphone separately. I have not tested this out yet, but in theory it seems like it should work.

If you specifically want to know which channel corresponds to which microphone, you’ll likely need to inspect the device orientation, and have a table of where the microphones are located based on device type. For example:

if orientation == landscapeLeft && device == iPhoneX {
  print(“the right audio channel source is the Face ID microphone”)
  print(“the left audio channel source is the dock connector microphone”)
} …
like image 1
Senseful Avatar answered Oct 27 '22 03:10

Senseful