Well, let´s see if I can help you some ... "The question is .... 1. For real time streaming operation how to configure the write(byte[], int offsetInBytes, int sizeInBytes) methods??? "
For real time or offline streaming, it works the same way: as you receive your packets, call write so you can fill AudioTrack´s internal buffer with the voice data. As the buffer is read, your audio will be played by the system by itself. Parameters for this function are well described on Android´s documentation. "2. What is the function and purpose of getPlaybackHeadPosition()???... What is playback head position kindly explain! " Playback head position can show you the actual status of AudioTrack´s internal buffer: the position returned is the last avaliable sample in the buffer. This way you know how full/empty it is and then take actions as needed. To tell you the truth, unless there´s something really unique/special in your code you won´t use it. The playback will occur just like in any audio device: fill the buffer and the data will be played. The write call blocks if the buffer doesn ´t have enough space for your data so you don´t have to syncronize anything (like a producer/consumer algorithm). What you will probably need is a separate thread to garantee you don´t lose packets when blocket by write(). One last thing: all android audio applications have a considerable audio delay because of the way audio is handled by the system. In it´s actual state it´s not possible to develop low latency audio applications. Hope it helps, Gabriel On 18 maio, 13:16, BobG <[email protected]> wrote: > 8khz sample rate sends 8 samples per ms. If you bundle up 50ms worth > of samples in a packet (400 samples, 800 bytes) and send them the 50 > ms lag is almost undetectable (unless you can hear the original too... > 2 phones at the same time for example) > > -- > 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 > athttp://groups.google.com/group/android-developers?hl=en -- 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

