How avoid automatic gain control with AudioRecord?

前端 未结 4 923
我在风中等你
我在风中等你 2020-12-05 01:48

How can I do audio recordings using android.media.AudioRecord without any smartphone-manufacturer-dependent fancy signal processing like automatic gain control

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-05 01:56

    Some devices add AGC effect to the sound input tract by default. Therefore, you need to obtain reference to corresponding AudioEffect object and force it to disable.

    First, obtain AutomaticGainControl object linked to the AudioRecord audio session, and then just set it disabled:

    if (AutomaticGainControl.isAvailable()) {
        AutomaticGainControl agc = AutomaticGainControl.create(
                myAudioRecord.getAudioSessionId()
            );
        agc.setEnabled(false);
    }
    

提交回复
热议问题