Problem using AudioRecord with 8-bit encoding in android

Posted by maxsap on Stack Overflow See other posts from Stack Overflow or by maxsap
Published on 2010-02-23T16:37:42Z Indexed on 2010/03/11 17:49 UTC
Read the original article Hit count: 196

Filed under:

Hello, I have made an application that records from the phones microphone using the AudioRecord and 16-bit encoding, and I am able to playback the recording. For some compatibility reason I need to use 8-bit encoding, but when I try to run the same program using that encoding I keep getting an Invalid Audio Format. my code is :

int bufferSize = AudioRecord.getMinBufferSize(11025, 
AudioFormat.CHANNEL_CONFIGURATION_MONO, 
AudioFormat.ENCODING_PCM_8BIT);
AudioRecord recordInstance = new AudioRecord(
MediaRecorder.AudioSource.MIC, 11025,
 AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_8BIT,
bufferSize);

Any one knows what is the problem? according to the documentation AudioRecord is capable of 8-bit encoding. thanks in advanced maxsap.

© Stack Overflow or respective owner

Related posts about android