开发者

Recording audio in android

开发者 https://www.devze.com 2023-03-23 05:49 出处:网络
I want to record o开发者_如何转开发wn voice or any through mic(In any way) into a file in my project and want to read later and listen to it.How can i do this? Anyone reply me please.http://developer.

I want to record o开发者_如何转开发wn voice or any through mic(In any way) into a file in my project and want to read later and listen to it.How can i do this? Anyone reply me please.


http://developer.android.com/guide/topics/media/index.html

About 3/4 the way down the page you'll see

Performing Audio Capture Audio capture from the device is a bit more complicated than audio and video playback, but still fairly simple:


Create a new instance of android.media.MediaRecorder.
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.

Followed by code showing exactly how to store audio input and play it back, hope this helps. (I tried to paste the code here but pasting from android's guides is difficult)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号