Possible Duplicate:
Improve Audio Recording quality in android?
I want to record audio to a 3gp file. I can do it without any problem and can hear the voice. But the voice i can hear is very slow and not clear. To increase voice quality i wrote a program but get java.lang.RuntimeException: start failed
public void onClick(View arg0)
{
root=Environment.getExternalStorageDirectory();
audiofile=new File(root,"sound.3gp");
if(!audiofile.exists())
{
Log.w(TAG, "File doesn't exists");
try
{
audiofile.createNewFile();
} catch (IOException e)
{
Log.w(TAG, "Unable to create audio file",e);
}
}
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
recorder.setOutputFile(audiofile.getAbsolutePath());
try
{
recorder.setAudioSamplingRate(10);
recorder.setAudioEncodingBitRate(20);
recorder.prepare();
} catch (IllegalStateException e)
{
Log.w(TAG, "This is IllegalStateException");
} catch (IOException e)
{
Log.w(TAG, "This is IoException");
}
recorder.start();
}
what is wrong in my code? thanks.