The iPhone 5 has three microphones: top, top and bottom. I would like to record everything on them at the same time to do some signal processing. I tried several days unsuccessfully.
Using AVAudioSession, I see microphones:
NSLog(@"%@", [AVAudioSession sharedInstance].availableInputs); "<AVAudioSessionPortDescription: 0x14554400, type = MicrophoneBuiltIn; name = iPhone Microphone; UID = Built-In Microphone; selectedDataSource = Back>" NSLog(@"%@", [AVAudioSession sharedInstance].availableInputs[0].inputDataSources); "<AVAudioSessionDataSourceDescription: 0x145afb00, ID = 1835216945; name = Bottom>", "<AVAudioSessionDataSourceDescription: 0x145b1870, ID = 1835216946; name = Front>", "<AVAudioSessionDataSourceDescription: 0x145b3650, ID = 1835216947; name = Back>"
I can use AVAudioSessionPortDescription -setPreferredDataSource:error: to record from one of three. But I canβt record more than one at a time. If I set the number of input channels to 2, I get two identical tracks from the same microphone.
AVAudioRecorder has a channelAssignments property that seems to work, but AVAudioSession inputNumberOfChannels and maximumInputNumberOfChannels are 1. The channelAssignments property is for auxiliary microphones that have multiple channels.
I tried to use low-level AudioUnit, but I get the same result. I could not find any properties in AudioUnit to change the input source.
Any help would be appreciated.
source share