How to increase volume of sound recorded using AVA

2020-02-24 13:14发布

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?

3条回答
Melony?
2楼-- · 2020-02-24 13:33

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.

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2020-02-24 13:36

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

查看更多
放我归山
4楼-- · 2020-02-24 13:51

you can try AVaudioSession.sharedInstance().overrideOutputAudioPort(AVAudioSessionPortOverride.Speaker) this is because your output device set to inbuilt speaker in iPhone. while iTab have only speaker so no problem occurs.

查看更多
登录 后发表回答