self.audioSession = [AVAudioSession sharedInstance]; if (self.audioSession.isInputGainSettable) { BOOL success = [self.audioSession setInputGain:sender.value error:&error]; if (!success) NSLog(@"inputGain error: %@",error); }
This is for ios6 + ... for ios5, you can use the AudioSessionGetProperty / AudioSessionSetProperty functions to achieve the same.
However, not all hardware is capable of adjusting input gain. For example, I get a win installed on an iPhone 3GS / ios6 with a built-in microphone, but the gain is NOT installed on an iPad mini with a built-in microphone. On the iPhone 3GS, the gain is also not set until recording has begun. (edit: iPhone 4S / ios5 also has the ability to configure with a built-in microphone)
Update
As you pointed out, you are looking for an OSX solution, not iOS. I moved this answer (in more detail) to a more convenient place .
For OSX, you can find this Q & useful:
How to set the input level (gain) to the built-in input (OSX Core Audio / Audio Unit)?
source share