简体   繁体   English

对于 Android,Output 格式和音频编码器的最佳组合是什么来录制高质量的语音?

[英]For Android, what is the best combination of Output Format and Audio Encoder to record high quality speech?

I have found so far that MPEG_4 and THREE_GPP work as formats.到目前为止,我发现 MPEG_4 和 THREE_GPP 可以作为格式工作。 OGG does not work at all. OGG 根本不工作。 THREE_GPP fails with AMR_WB (wide band). THREE_GPP 因 AMR_WB(宽带)而失败。 "Does not work" / "fails" means my app crashes in the start() function from the code fragment below, as shown by LogCat from the Studio. “不起作用”/“失败”意味着我的应用程序在下面的代码片段的 start() function 中崩溃,如 Studio 中的 LogCat 所示。

private fun startRecording() {
    recorder = MediaRecorder().apply {
        setAudioSource(MediaRecorder.AudioSource.MIC)
        setOutputFormat(MediaRecorder.OutputFormat.MPEG_4)   //OGG fails
        setOutputFile(fileName)
        setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT)  // VORBIS fails with format OGG

        try {
            prepare()
        } catch (e: IOException) {
            Log.e(LOG_TAG, "prepare() failed")
        }

        start()  // failures occur here
    }
}

Any recommendations would be appreciated.任何建议将不胜感激。 Please note the speech in the audio stream will need to be converted to text on the Android device.请注意音频 stream 中的语音需要在 Android 设备上转换为文本。

I have found so far that MPEG_4 and THREE_GPP work as formats.到目前为止,我发现 MPEG_4 和 THREE_GPP 可以作为格式工作。 OGG does not work at all. OGG 根本不工作。 THREE_GPP fails with AMR_WB (wide band). THREE_GPP 因 AMR_WB(宽带)而失败。 "Does not work" / "fails" means my app crashes in the start() function from the code fragment below, as shown by LogCat from the Studio. “不起作用”/“失败”意味着我的应用程序在下面的代码片段的 start() function 中崩溃,如 Studio 中的 LogCat 所示。

private fun startRecording() {
    recorder = MediaRecorder().apply {
        setAudioSource(MediaRecorder.AudioSource.MIC)
        setOutputFormat(MediaRecorder.OutputFormat.MPEG_4)   //OGG fails
        setOutputFile(fileName)
        setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT)  // VORBIS fails with format OGG

        try {
            prepare()
        } catch (e: IOException) {
            Log.e(LOG_TAG, "prepare() failed")
        }

        start()  // failures occur here
    }
}

Any recommendations would be appreciated.任何建议将不胜感激。 Please note the speech in the audio stream will need to be converted to text on the Android device.请注意音频 stream 中的语音需要在 Android 设备上转换为文本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM