【问题标题】:How to improve the android recorded voice quality如何提高android录制的语音质量
【发布时间】:2019-02-08 11:01:41
【问题描述】:

我有以下用于在 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;
            }


问题是,与默认的安卓录音机应用程序或whatsApp/Telegram voice recorder相比,录制的音频文件的输出质量不好。

你有什么建议?我可以做些什么来提高录音的质量?

【问题讨论】:

    标签: java android voice-recording


    【解决方案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);
    

    【讨论】:

      【解决方案2】:

      如果我们查看文档:https://developer.android.com/reference/android/media/MediaRecorder.OutputFormat,我们可以看到有很多可用的音频格式。您正在使用THREE_GPP,据我所知,它不能提供最好的质量。我会考虑改用MPEG_4。同时尝试使用AAC 而不是AMR 作为音频编码器。

      还请查看此答案以获取更多参考:https://stackoverflow.com/a/14973295/5457878

      【讨论】:

        猜你喜欢
        • 2010-11-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-01-30
        相关资源
        最近更新 更多