mail2chromium / Android-Audio-Processing-Using-WebRTC

All in all WebRTC. A Complete Guide to enable Rich and High Quality of **Real-Time Voice Communication** on Android Platform. This repository involves a complete understanding, implementation and documentation related to WebRTC Audio Processing.
144 stars 49 forks source link

Question about "MODE_IN_COMMUNICATION" #8

Open DengYu98 opened 2 years ago

DengYu98 commented 2 years ago

Hi @mail2chromium , there is a question: If you set the MODE_IN_COMMUNICATION, you probably don't need the apm using webrtc.

AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);

I found out if i set MODE_IN_COMMUNICATION, the voice is pretty, i didn't listen any echo. if i don't set MODE_IN_COMMUNICATION, only use the apm using webrtc, the voice is not that good. what is the diff?? btw, what the webrtc version compiled in this project? would you please kindly help to give me a reply soon? Thanks in advance!

mail2chromium commented 1 year ago

The difference is that MODE_IN_COMMUNICATION sets the audio mode for communication mode, which is optimized for voice calls. On the other hand, if you are only using the APM (Automatic Gain Control, Noise Suppression, Echo Cancellation, etc.) provided by WebRTC, the audio quality may not be as good as it would be in communication mode. Setting the audio mode to MODE_IN_COMMUNICATION enables the device to automatically apply the best audio processing settings for voice calls, which may result in better voice quality.


After reading the above statement, you may come up with some additional questions like If Hardware-based AEC, AGC, & NS are already working, then what is the use case of WebRTC APM?

WebRTC's APM (Automatic Gain Control, Noise Suppression, Echo Cancellation, etc.) can still be useful even when the audio mode is set to MODE_IN_COMMUNICATION.

WebRTC's APM provides a set of real-time audio processing algorithms that can be used to enhance the quality of voice and video calls. These algorithms can be used in conjunction with the audio processing algorithms and settings provided by the device's audio mode to further improve the quality of the call.

Example: Even though the MODE_IN_COMMUNICATION mode may provide some echo cancellation, noise suppression, and automatic gain control, the WebRTC's APM may provide additional, or different, implementations of these algorithms that can further improve the audio quality.

Therefore, using the APM provided by WebRTC in addition to setting the audio mode to MODE_IN_COMMUNICATION can help to further enhance the overall quality of voice and video calls.