如何通过使用Android的内置麦克风录制声音 [英] How to record sound by using inbuilt microphone in android
本文介绍了如何通过使用Android的内置麦克风录制声音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要使用移动自己的话筒......怎么办呢录制声音?
解决方案
它解释 一>
从设备中音频采集有点 除音频更复杂/视频 播放,但仍然相当简单:
- 在使用创建android.media.MediaRecorder的新实例,新的
- 设置使用MediaRecorder.setAudioSource音频源()。您 将可能需要使用 MediaRecorder.AudioSource.MIC
- 在使用MediaRecorder.setOutputFormat()设置输出文件格式
- 在使用MediaRecorder.setOutputFile()设置输出文件名
- 在使用MediaRecorder.setAudioEn codeR()设置了音频连接codeR
- 在MediaRecorder实例调用MediaRecorder。prepare()。
- 要启动音频采集,调用MediaRecorder.start()。
- 要停止音频采集,调用MediaRecorder.stop()。
- 当你与MediaRecorder实例来完成,通话 MediaRecorder.release()就可以了。调用 MediaRecorder.release()总是 建议以释放资源 立即
I need to record sound by using mobile's own microphone... How to do it?
解决方案
It's explained here
Audio capture from the device is a bit more complicated than audio/video playback, but still fairly simple:
- Create a new instance of android.media.MediaRecorder using new
- Set the audio source using MediaRecorder.setAudioSource(). You will probably want to use MediaRecorder.AudioSource.MIC
- Set output file format using MediaRecorder.setOutputFormat()
- Set output file name using MediaRecorder.setOutputFile()
- Set the audio encoder using MediaRecorder.setAudioEncoder()
- Call MediaRecorder.prepare() on the MediaRecorder instance.
- To start audio capture, call MediaRecorder.start().
- To stop audio capture, call MediaRecorder.stop().
- When you are done with the MediaRecorder instance, call MediaRecorder.release() on it. Calling MediaRecorder.release() is always recommended to free the resource immediately.
这篇关于如何通过使用Android的内置麦克风录制声音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文