Denial, I tried what u said,but it dint solve my problem but producing more echo.. I think its happening bcoz voice coming from speaker is also going in mic.
If u have ny idea about it,Plz help. On May 26, 1:20 pm, Daniel Drozdzewski <[email protected]> wrote: > On Thu, May 26, 2011 at 11:59 AM, neha <[email protected]> wrote: > > Thanx alot 4 rply > > but if i use large buffer size ,it produce delay between record and > > play. > > Neha, > > All I suggested was to use the larger of values returned by both > getMinBufferSize() calls for all 3 aspects: recording, playing and > transfer of the data instead of arbitrary 400. > > > > > > > On May 26, 11:46 am, Daniel Drozdzewski <[email protected]> > > wrote: > >> Neha, > > >> Your echo comes from the fact that you are using 400 bytes buffer to > >> transfer the recording to the playback. > >> It will physically take time to fill that buffer and then process. > > >> Making the buffer much smaller might not necessarily work either, as > >> it will mean more overhead of the recording + playing management in a > >> unit of time. However adjusting the buffer size would be a first step. > > >> You are using getMinBufferSize() method, but you ignore the returned > >> values, when it comes to the buffer used to transfer the recording to > >> the playback track. > > >> You should use Math.max(recordingMinBufferSize, playbackMinBufferSize) > >> as a buffer size in all 3 cases. > >> You should also write only bytesRead bytes, rather than writing full > >> buffer every time. > > >> Daniel > > >> On Thu, May 26, 2011 at 10:28 AM, neha <[email protected]> wrote: > >> > 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 > > >> -- > >> Daniel Drozdzewski > > > -- > > 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 > > -- > Daniel Drozdzewski -- 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

