My audio-analysis function responds better on the iPad (2) than the iPhone (4). It seems sensitive to softer sounds on the iPad, whereas the iPhone requires much louder input to respond properly. Whether this is because of mic placement, different components, different software configurations or some other factor, I'd like to be able to control for it in my app.
Obviously I could just multiply all of my audio samples to programmatically apply gain. Of course that has a software cost too, so:
Is it possible to control the mic's gain from software in iOS, similarly to how it is in MacOS? I can't find any documentation on this but I'm hoping I'm just missing it somehow.
On ios6+ you can use AVAudioSession properties
On ios5 you can get/set audio input gain properties using AudioSession functions
(error handling omitted)
As you are interested in controlling input gain, you may also want to disable automatic gain control by setting the audio session mode to
AVAudioSessionModeMeasurement
(ios5+6)These settings are fairly hardware-specific so availability cannot be assumed. For example, I can alter the gain on iPhone3GS/ios6 and iPhone4S/ios5.1, but not on ipadMini/ios6.1. I can disable AGC on the iPhone3G and the iPad mini, but not the iPhone4S.