title: MediaRecorder starts with a 1 sec delay. How do I get rid of the silence?
body: <p>I am trying to use MediaRecorder in a Service to record sounds. But it creates a 1 sec delay (silence) at the start. how to i get rid of this?  I tried using <a href="http://rehearsalassist.svn.sourceforge.net/viewvc/rehearsalassist/android/releases/RehearsalAssistant_0_8_2/src/urbanstew/RehearsalAssistant/RehearsalAudioRecorder.java?revision=90&amp;view=markup" rel="nofollow">RehearsalAudioRecorder</a> still has no luck. If anyone has fixed this problem before please advice.</p>
  
  <p>Start</p>
  
  <pre><code>Intent serviceIntent = new Intent();
              serviceIntent.setAction("com.soundrecoder.RecorderService");
              serviceIntent.putExtra("audioFile", path);
              serviceIntent.putExtra("state", true);
              startService(serviceIntent);
  </code></pre>
  
  <p>Stop</p>
  
  <pre><code>Intent serviceIntent = new Intent();
              serviceIntent.setAction("com.soundrecoder.RecorderService");
              serviceIntent.putExtra("state", false);
              startService(serviceIntent);
  </code></pre>
  
  <p>RecorderService.java file</p>
  
  <pre><code>public class RecorderService extends Service
  {
      private static final String TAG = null;
      private static MediaRecorder mRecorder;
  
      public void onCreate() {};
  
      public void onStart(Intent intent, int startId)
      {
          boolean isStart = intent.getBooleanExtra("state", false);
  
          if (isStart) {
              mRecorder = new MediaRecorder();
              mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
              mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
              mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
              mRecorder.setOutputFile(intent.getStringExtra("audioFile"));
  
              try {
                  mRecorder.prepare();
              } catch (IllegalStateException e) {
                  Log.e(TAG,e.getMessage());
              } catch (IOException e) {
                  Log.e(TAG,e.getMessage());
              }
              try {
                  mRecorder.start();
              }
              catch (IllegalStateException e) {
                  Log.e(TAG, e.getMessage());
              }
          }
  
          else if (!isStart) {
              mRecorder.stop();
              mRecorder.reset();
          }
      }
  
      @Override
      public IBinder onBind(Intent intent) {
          return null;
      }
  }
  </code></pre>