title: to record audio and then to playback with AudioRecord, AudioTrack.trouble
body: <p>i made a audio-recording in real-time and then playback, but when i get started
  it sounded very noisy sounds and my voice. so i want to get my voice only with clean tone</p>
  
  <p>im implementing this app with reverb, bass boost, equalizer and visualizer effects</p>
  
  <p>i just wanna clean sounds without those effects</p>
  
  <p>as for this app target version is at least for Android 2.3.3(api 10)  </p>
  
  <p><strong>Q : how do i have to modify this substantial code part? (for audioRecord.startRecording, audioTrack.record, audioTrack.write)</strong> </p>
  
  <p>here is my code snippet as below :</p>
  
  <p>////////////////////////////////////</p>
  
  <pre><code>private void main() {
  
          for (;;) {
  
              Log.d("AFX", "Starting audio thread");
              this.audioRecord.startRecording();
              this.audioTrack.play();
  
              int i;
  
              if (!this.running) {
                  this.audioRecord.stop();
                  this.audioTrack.stop();
                  this.audioRecord.release();
                  return;
              }
  
              i = this.audioRecord.read(this.buffer, 0, this.chunkSize);
              Log.v("AudioRecord", "read " + this.chunkSize + "bytes");
  
              try {
  
                  // Log.d("AFX", "Starting audio thread");
                  this.audioRecord.startRecording();
                  this.audioTrack.play();
                  Log.d("AFX", "Starting audio thread");
  
                  boolean flag = this.running; // df value : false
  
                  if (!flag) {
                      this.audioRecord.stop();
                      this.audioTrack.stop();
                      // this.audioRecord.release(); // added
                      // this.audioTrack.release(); // added
                      Log.d("AFX", "Exiting audio thread");
                      return;
                  }
  
                  i = this.audioRecord.read(this.buffer, 0, this.chunkSize);
                  Log.v("AudioRecord", "read " + this.chunkSize + "bytes");
  
                  if (i &lt; 0) {
                      Log.e("AFX", "Record error: " + i);
                      this.running = false;
                      continue;
                      // break;
                  }
                  if (!this.running) {
                      continue;
                      // break;
                  }
  
              } finally {
                  this.audioRecord.stop();
                  // this.audioRecord.release(); // added
                  this.audioTrack.stop();
                  // this.audioTrack.release(); // added
              }
  
              this.audioTrack.write(this.buffer, 0, i);
              // Log.d("AFX", "Starting audio thread");
              // this.audioRecord.startRecording();
              // this.audioTrack.play();
          }
      }
  </code></pre>
  
  <p>any idea'll be appreciated</p>
  
  <p>thank you much</p>