Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adjusting Input Volume using AVFoundation (in an AVCaptureSession)

I've looked everywhere, and I can't find a way to adjust the input volume of an input device for an AVCaptureSession. The best I can do, which doesn't help me at all, is get the levels of audio from the device by accessing the connections (AVCaptureConnections) from the AVCaptureAudioDataOutput - i.e., by monitoring the levels from a preview output. Is there any way to change the input gain, or even to get the audio input level directly in AVFoundation? I'm still learning a bit, so I apologize if I have missed anything obvious.

Edit: I should note that this is for OSX.

like image 380
ewrobinson Avatar asked Oct 05 '22 04:10

ewrobinson


1 Answers

So, I used some info that He Was linked, along with some research into Core Audio, and I turned it into a github project. That way, other people wanting to change the input volume of a device while using AVFoundation don't have to reinvent the wheel. You can find the classes here: https://github.com/ewrobinson/ERVolumeAdjust

like image 91
ewrobinson Avatar answered Oct 13 '22 12:10

ewrobinson