我有以下用于在android中录制音频/语音的代码:
MediaRecorder recorder=new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setAudioEncodingBitRate(16);
recorder.setAudioSamplingRate(44100);
recorder.setOutputFile(Environment.getExternalStorageDirectory() + File.separator
+ Environment.DIRECTORY_DCIM + File.separator + "WAVES.amr");
try {
recorder.prepare();
recorder.start();
} catch (IOException e) {
Toast.makeText(topic_player_list_layout.this,"Unable to record",Toast.LENGTH_SHORT).show();
return;
}
问题是,与默认的Android语音记录器应用或whatsApp/Telegram voice recorder
相比,记录的音频文件质量输出不佳。
你有什么建议?我该怎么做才能提高录音质量?
答案 0 :(得分:1)
您必须增加audioEncodingBitRate
MediaRecorder recorder=new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setAudioEncodingBitRate(128000);
recorder.setAudioSamplingRate(44100);
答案 1 :(得分:0)
如果我们看一下文档:https://developer.android.com/reference/android/media/MediaRecorder.OutputFormat,我们可以看到有很多可用的音频格式。据我所知,您使用的objectReturnHelper: function() {
var obj1 = 5;
var obj2 = 10;
return {
obj1: _.range(0, obj1),
obj2: _.range(0, obj2)
};
}
{{#each objectReturnHelper.obj1}}
<p>TEST</p>
{{/each}}
不能提供最佳质量。我会考虑改用THREE_GPP
。另外,请尝试使用MPEG_4
代替AAC
作为音频编码器。
也请查看此答案以获取更多参考:https://stackoverflow.com/a/14973295/5457878