I'm using a class that uses AudioRecord.

                                RehearsalAudioRecorder recorder = new 
RehearsalAudioRecorder(
                                                
RehearsalAudioRecorder.RECORDING_UNCOMPRESSED,
                                                MediaRecorder.AudioSource.MIC,
                                                16000,
                                                AudioFormat.CHANNEL_IN_MONO,
                                                AudioFormat.ENCODING_PCM_16BIT);

The RehearsalAudioRecorder constructor instantiates an AudioRecord:

                              aRecorder = new AudioRecord(audioSource,
sampleRate, channelConfig, audioFormat, bufferSize);

I'm creating a .wav file on the SD card.

I'm experiencing a 5 second delay in the recording; I play back the
file, and the recording starts about 5 seconds after I started
speaking.

I did some measurements with System.currentTimeMillis(), and I
measured the following:

buffer size: 204800 bytes
constructor: 17 ms
write the file header: 6 ms
AudioRecord.startRecording(): 483 ms
AudioRecord.read(): 6268 ms

There's correspondingly less delay when I use a smaller buffer:

buffer size: 81920 bytes
constructor: 16 ms
write the file header: 5 ms
AudioRecord.startRecording(): 486 ms
AudioRecord.read(): 2427 ms

Does anyone have any suggestions as to how to reduce the delay?  It's
still unacceptable to have a few seconds delay.


-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to