gpt4 book ai didi

android - android录音音量变化

转载 作者:行者123 更新时间:2023-12-03 02:29:03 25 4
gpt4 key购买 nike

现在,我正在开发一个Android应用程序来录制语音。我通过使用以下代码来做到这一点。

m_recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
m_recorder.setOutputFormat(OutputFormat.THREE_GPP);

m_recorder.setAudioEncoder(AudioEncoder.AMR_NB);
// m_recorder.setAudioEncoder(MediaRecorder.getAudioSourceMax());
m_recorder.setAudioEncodingBitRate(128);
m_recorder.setAudioSamplingRate(44100);

m_recorder.setOutputFile(Environment.getExternalStorageDirectory() + "/audio.3gp");
try {
m_recorder.prepare();
m_recorder.start();
}

但是问题是我的声音太小了,我在网上搜索了解决方法,我得到的只是

"There is no way to do this while recording - but while playing, you can use the setVolume(float, float) method on MediaPlayer."



但是我必须将录制的片段上传到服务器上,那么有什么办法可以将低音量的声音片段转换为高音量的片段?

最佳答案

我使用以下代码记录和保存文件,它对我有用:

                    recorder = new MediaRecorder();
FileOutputStream fos = openFileOutput(fileNameStr,
MODE_PRIVATE);

recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setOutputFile(fos.getFD());
recorder.prepare();
recorder.start();

关于android - android录音音量变化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9942297/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com