title: How to only play microphone sound output in real-time?
body: <p>Im using AudioRecord and AudioTrack to play the sound output from the microphone to the speakers.But <strong>real-time playback creates sound echo</strong>.I need to only play MIC sound and not the sound played by android system(which in this case is the MIC AudioTrack which is played for the second time).</p>
  
  <pre><code>            recorder = new AudioRecord(AudioSource.MIC, 44100,
                  AudioFormat.CHANNEL_IN_MONO,
                  AudioFormat.ENCODING_PCM_16BIT, N * 2);
          track = new AudioTrack(AudioManager.STREAM_MUSIC, 44100,
                  AudioFormat.CHANNEL_OUT_MONO,
                  AudioFormat.ENCODING_PCM_16BIT, N * 2,
                  AudioTrack.MODE_STREAM);
  </code></pre>
  
  <p>How to isolate microphone sound output in android and play it without playing whole the android sounds(other sounds which are played in android device,eg music played by a music player, notification sounds etc)</p>
  
  <p>PS: found this comment after some researching on <a href="https://stackoverflow.com/questions/10486291/how-to-amplify-audio-from-app-in-android">this stackoverflow qs's comment by  hotpaw2 </a>:</p>
  
  <pre><code>The latency on most Android devices between record and play is reported to be fairly  high, such that the user would hear a delayed echo unless isolated from any sound going  into the mic.
  </code></pre>