How to increase the microphone volume level in Android PJSIP?

I have built-in PJSIP with android . When making a call in my application, the speaker works fine, but the microphone volume is too low . My voice is not heard by the other side.

Note. But on some mobile phones it works fine.

Even I tried using the adjustStreamVolume (), setStreamVolume (), setMode (), adjustVolume () methods to increase the volume level, but it does not increase. Please give me a suggestion to solve this problem to increase the microphone volume level in Android or PJSIP.

Thanks at Advance.

+5
source share
2 answers

The problem is that the microphone volume is too low when our application accesses through the microphone. When you have a low volume, you need to check a few things.

One of them is MODE OF AUDIO MANAGER when using a microphone.

Getting MODE Android Audio Manager ::

AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE); long mode = am.getMode(); Log.e(TAG,"audio mode "+mode); 

Setting MODE in Android Audio Manager ::

 AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE); am.setMode(3); 

You can access the audio manager mode through this code for your application. There is 1.MODE_NORMAL
2.MODE_RINGTONE
3.MODE_IN_CALL
4.MODE_IN_COMMUNICATION

PS : whenever you change the AudioManager mode, after using the microphone, change it to MODE_NORMAL, otherwise it will not work after restarting the mobile device.

+2
source

It seems to me that setStreamVolume and the like are more used for speakers, not for mic control.

From the PJSIP docs you can see that there is a method that can adjust the received signal level.

You can use it as shown below, where the volume is between 0 and 2.0 .

 pjsua_conf_adjust_rx_level(0, volume); 

In several places, I saw that you might need root access to change this setting anyway, or for you to have a MediaTek chip.

Instead, you can increase the gain from your stream directly. This answer shows you how you could do this when the gain is also in the same range.

+3
source

All Articles