提高 Android 录音质量?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1437888/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 03:05:27  来源:igfitidea点击:

Improve Android Audio Recording quality?

androidaudio-recording

提问by Lyubomyr Dutko

Is there any way to record audio in high quality?

有没有办法录制高质量的音频?

And how can I read information that user is saying something? In Audio Recording application you can see such indicator (I don't know the right name for it).

以及如何阅读用户所说的信息?在录音应用程序中,您可以看到这样的指示器(我不知道它的正确名称)。

采纳答案by Donn Felker

For recording and monitoring: You can use the sound recorder activity. Here's a snippet of code:

对于录音和监听:您可以使用录音机活动。这是一段代码:

Intent recordIntent = new Intent(
                MediaStore.Audio.Media.RECORD_SOUND_ACTION);
            startActivityForResult(recordIntent, REQUEST_CODE_RECORD);

For a perfect working example of how to record audio which includes an input monitor, download the open source Ringdroid project: https://github.com/google/ringdroid

有关如何录制包含输入监视器的音频的完美示例,请下载开源 Ringdroid 项目:https: //github.com/google/ringdroid

Look at the screenshots and you'll see the monitor.

查看屏幕截图,您会看到监视器。

For making the audio higher quality, you'd need a better mic. The built in mic can only capture so much (which is not that good). Again, look at the ringdroid project, glean some info from there. At that point you could implement some normalization and amplification routines to improve the sound.

为了使音频质量更高,您需要更好的麦克风。内置麦克风只能捕获这么多(这不是很好)。再次查看 ringdroid 项目,从那里收集一些信息。此时,您可以实施一些标准化和放大例程来改善声音。

回答by Stjepan Rajko

At the moment, a big reason for poor audio quality recording on Android is the codec used by the MediaRecorder class (the AMR-NB codec). However, you can get access to uncompressed audio via the AudioRecord class, and record that into a file directly.

目前,Android 上录制音频质量不佳的一个重要原因是 MediaRecorder 类(AMR-NB 编解码器)使用的编解码器。但是,您可以通过 AudioRecord 类访问未压缩的音频,并将其直接录制到文件中。

The Rehearsal Assistant appdoes this to save uncompressed audio into a WAV file - take a look at the RehearsalAudioRecordclass source code.

排练助理应用程序这样做是为了未压缩的音频保存成WAV文件-看看在RehearsalAudioRecord类的源代码。

The RehearsalAudioRecord class also provides a getMaxAmplitude method, which you can use to detect the maximum audio level since the last time you called the method (MediaRecorder also provides this method).

RehearsalAudioRecord 类还提供了一个 getMaxAmplitude 方法,您可以使用它来检测自上次调用该方法以来的最大音频电平(MediaRecorder 也提供了此方法)。