Reputation: 1639
I'm trying to add more gain to the AVAudioSession.
I'm using AVAssetWriter to record a video with audio, but I would like to add more gain to the audio.
I saw there is a method in AVAudioSession to set the inputGain
, but it must be between 0 and 1.
[[AVAudioSession sharedInstance] setInputGain:2.0 error:nil];
Is there any way to add more gain even if I have to lose quality?
Thanks
Upvotes: 2
Views: 520
Reputation: 36084
You could increase the gain yourself by modifying the incoming audio LPCM CMSampleBuffer
s before you pass them on to the AVAssetWriter
. NB: AVCaptureSession
may not take kindly to you modifying its buffers, so you may need to duplicate them before modifying.
Alternatively, you may get more gain using AVAudioSessionModeMeasurement
:
NSError *error;
if (![[AVAudioSession sharedInstance] setMode:AVAudioSessionModeMeasurement error:&error]) {
// Error
}
which is
Appropriate for applications that wish to minimize the effect of system-supplied signal processing for input and/or output audio signals.
Upvotes: 1