如何调整在Android的麦克风音量? [英] How to adjust microphone volume in android?

查看:5278
本文介绍了如何调整在Android的麦克风音量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要刻录机的声音,但MIC(麦克风)输入声音太响了,我要调整麦克风音量,会有人帮助我吗?以下是主要的code:

 私人INT audioSource = MediaRecorder.AudioSource.MIC;

私有静态诠释sampleRateInHz = 8000;

私有静态诠释channelConfig = AudioFormat.CHANNEL_CONFIGURATION_MONO;

私有静态诠释AudioFormat的= AudioFormat.ENCODING_PCM_16BIT;

audioRecord =新AudioRecord(audioSource,sampleRateInHz,channelConfig,AudioFormat的,bufferSizeInBytes);
audioManager.setSpeakerphoneOn(假);
 

解决方案

当话筒打开时,它使用的 AudioManager.STREAM_MUSIC

试着增加此卷,并检查麦克风的音量也增加了。

使用:

  AudioManager上午=(AudioManager)getSystemService(Context.AUDIO_SERVICE);
am.setStreamVolume(AudioManager.STREAM_MUSIC,yourVolume,0);
 

I want to recorder the sound, but the mic (microphone) input sound is too loud, and I want to adjust the mic volume, would someone help me? The following is the main code:

private int audioSource = MediaRecorder.AudioSource.MIC;

private static int sampleRateInHz = 8000;

private static int channelConfig = AudioFormat.CHANNEL_CONFIGURATION_MONO;

private static int audioFormat = AudioFormat.ENCODING_PCM_16BIT;

audioRecord = new AudioRecord(audioSource, sampleRateInHz,channelConfig, audioFormat, bufferSizeInBytes);
audioManager.setSpeakerphoneOn(false);

解决方案

When the microphone is open, it used the volume of the AudioManager.STREAM_MUSIC.

Try to increase this volume and check if the microphone volume also increased.

With:

AudioManager am = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
am.setStreamVolume(AudioManager.STREAM_MUSIC, yourVolume, 0);

这篇关于如何调整在Android的麦克风音量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆