如何通过使用Android的内置麦克风录制声音声音、内置麦克风、Android

2023-09-06 00:32:33 作者:-如果时光她寂寞

我需要使用移动自己的话筒......怎么办呢录制声音?

解决方案

它解释

  

从设备中音频采集有点   除音频更复杂/视频   播放,但仍然相当简单:

        在使用创建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

如何从 Android 的快速设置中禁用麦克风和摄像头

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.