title: Android AudioTrack latency with playback
body: <p>I am trying to play raw sound data using <code>AudioTrack</code> class in Android, I am using the <code>write</code> method, but I noticed that there is a latency between the write method returns and the actual sound is played, to make it simple let us use <code>AudioRecord</code> class as the following psedu code:</p>
  
  <pre><code>//init AudioTrack
  //init AudioRecord
  while(true){
      byte [] buffer = new byte[1000];
      int read = audioRecord(buffer,0,1000);
      audioTrack.write(buffer,0,read);
  }
  </code></pre>
  
  <p>I expect to get latency that is <code>read / sample rate</code> seconds but the actual sound is played after and extra of about 0.5 seconds, I really need the audio to be played with minimum latency, so does anyone has an explanation of what is going on and is there any available solution or should I accept this as it is a hardware issue? </p>