# Set Microphone Gain of ipad/iPhone

**URL:** <https://forum.juce.com/t/set-microphone-gain-of-ipad-iphone/12668>\
**Category:** MacOSX and iOS\
**Created:** [April 9, 2014, 11:00am UTC](https://forum.juce.com/t/set-microphone-gain-of-ipad-iphone/12668 "2014-04-09T11:00:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mfink](https://avatars.discourse-cdn.com/v4/letter/m/b9bd4f/32.png) [@mfink](https://forum.juce.com/u/mfink)\
**Post date:** [April 9, 2014, 11:00am UTC](https://forum.juce.com/t/set-microphone-gain-of-ipad-iphone/12668/1 "2014-04-09T11:00:12Z")

</div>

Adding a function for changing the microphone gain of iOS devices in the AudioIODevice class would be very helpful and could be implemented very easily...

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [April 9, 2014, 11:58am UTC](https://forum.juce.com/t/set-microphone-gain-of-ipad-iphone/12668/2 "2014-04-09T11:58:21Z")

</div>

Yes, that'd probably be a good addition to the&nbsp;SystemAudioVolume class.

---

<div class="post-metadata">

**Author:** ![mfink](https://avatars.discourse-cdn.com/v4/letter/m/b9bd4f/32.png) [@mfink](https://forum.juce.com/u/mfink)\
**Post date:** [April 9, 2014, 12:16pm UTC](https://forum.juce.com/t/set-microphone-gain-of-ipad-iphone/12668/3 "2014-04-09T12:16:47Z")

</div>

I extended the iOSAudioIODevice class locally with the following function:

&nbsp;&nbsp;&nbsp; bool setMicGain(float gain){  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; UInt32 gainAvailable = 0;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; getSessionProperty(kAudioSessionProperty\_InputGainAvailable, gainAvailable);  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(gainAvailable){  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; setSessionFloat32Property(kAudioSessionProperty\_InputGainScalar, (Float32)gain);  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return true;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }else{  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return false;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }  
&nbsp;&nbsp;&nbsp; }
