How to increase Microphone volume level in Android PJSIP?

会有一股神秘感。 提交于 2020-05-12 15:53:47

问题


I have Integrated PJSIP with android. While making call in my application, the Speaker is working perfectly but Recording microphone volume is too low. My voice is not hearable by other side.

Note: But in some mobiles it's working properly.

Even i tried with adjustStreamVolume(), setStreamVolume(), setMode(),adjustVolume() methods to increase my volume level, it doesn't increase in anyway. Please give me a suggestion to solve this problem to increasing microphone Volume level in Android or from PJSIP.

Thanks in Advance.


回答1:


Problem is Microphone volume level is too low when our application access through microphone. When you got low volume, you need to check multiple things.

One of them is MODE OF THE AUDIO MANAGER when microphone is used.

Getting MODE of the Android Audio manager::

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

Setting MODE of the Android Audio manager::

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

You can access the mode of audio manager through this above code for your app. There are
1.MODE_NORMAL
2.MODE_RINGTONE
3.MODE_IN_CALL
4.MODE_IN_COMMUNICATION

P.S. : Whenever you change the mode of the AudioManager, please change into MODE_NORMAL after using microphone otherwise it won't work once you restart the mobile.




回答2:


It looks like to me setStreamVolume and the like are more used for speakers rather than to control the microphone.

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

You can use it like the following, where volume is between 0 and 2.0.

pjsua_conf_adjust_rx_level(0, volume);

I saw in a few places that you might need root access to modify this parameter anyway, or that you need to have a MediaTek chip.

What you can do instead is increase the gain from your stream directly. This answer shows you how you could do it, where the gain is also in the same range.



来源:https://stackoverflow.com/questions/43861391/how-to-increase-microphone-volume-level-in-android-pjsip

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!