im making an application on android that requires to capture the user´s voice and recognize it. I tryed to record the audio using this code: http://xhampa.pastebin.com/Yr2hie6q on android 2.1. I realized that the sound wasn't recorded in a good quality at all (like slow motion). Unfortunally, I don't have an android to test it out, so I'm using the emulator. Is there anyway to imp开发者_Python百科rove record quality using the emulator?
The default recording quality when using mediarecorder is 4.75kbps and 8kHz, which is not adequate for any sort of audio processing. You simply need to change those values using the setAudioEncodingBitRate and setAudioSamplingRate methods.
setAudioSamplingRate(11.05)
setAudioEncodingBitRate(20)
The values that I included will optimize your audio quality, but you may need to change them to fit your needs.
Mediarecorder Documentation: http://developer.android.com/reference/android/media/MediaRecorder.html
精彩评论