Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase volume of sound recorded using AVAudioRecorder

I am using the link mentioned below to record audio through my iPhone app:

How do I record audio on iPhone with AVAudioRecorder?

When I try to play my recordings using AVAudioPlayer on my device, I have seen that the sound volume of my recordings is very low even when my device volume is full.

Recording is working fine.

What can be done to increase the volume?

like image 780
Parth Bhatt Avatar asked Apr 13 '11 18:04

Parth Bhatt


2 Answers

When recording audio, set the audio session to AVAudioSessionCategoryPlayAndRecord or just AVAudioSessionCategoryRecord. When you're done, set it back to just AVAudioSessionCategoryPlayback.

like image 96
Hollance Avatar answered Oct 14 '22 10:10

Hollance


Solution for iOS 12 + Swift 5.0:

  • When starting recording use:

    recordingSession.setCategory(.record) // recordingSession is of type AVAudioSession

  • When playing the record audio use:

    recordingSession.setCategory(.playback)

Note: Place the statements into a do-catch block.

like image 22
Baran Emre Avatar answered Oct 14 '22 11:10

Baran Emre