Is there any way to synchronize the capturing and playback of audio
data in Android?
I am using audioRecord/track to achieve this.But its producing echo.
Is there any way to cancel echo.
My code is-
{
isRecording=true;
bufferSize =
AudioRecord.getMinBufferSize(8000,AudioFormat.CHANNEL_CONFIGURATION_MONO,AudioFormat.ENCODING_PCM_16BIT);
audioRecord = new
AudioRecord(MediaRecorder.AudioSource.MIC,
8000,
AudioFormat.CHANNEL_CONFIGURATION_MONO,AudioFormat.ENCODING_PCM_16BIT,
bufferSize);
audioRecord.startRecording();
int BUFFER_SIZE_IN_BYTES
=AudioTrack.getMinBufferSize(RECORDER_SAMPLERATE,AudioFormat.CHANNEL_CONFIGURATION_MONO,RECORDER_AUDIO_ENCODING);
AudioTrack audioTrack = new
AudioTrack(AudioManager.STREAM_SYSTEM,
8000,AudioFormat.CHANNEL_CONFIGURATION_MONO,
AudioFormat.ENCODING_PCM_16BIT, BUFFER_SIZE_IN_BYTES,
AudioTrack.MODE_STREAM);
byte[] buffer=new byte[400];
audioTrack.play();
while (isRecording) { int bytesRead =
audioRecord.read(buffer,
0,
400);
int bytesWritten = audioTrack.write(buffer, 0,
400);
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en