title: Not able to play recorded audio file
body: <p>I am recording voice using one tutorial and for recording i am using class <code>AudioRecord</code> as i want to show progressbar with some noise level. I am providing file in which the audio data will be stored. The size of file is being increasing as it gets audio data. But when i manually play that recorded file but it doesn't play anything. Can anyone tell me what i am missing?</p>
  
  <pre><code>private class RecordAudio extends AsyncTask&lt;Void, Void, Void&gt; {
  
          boolean alertshown = false;
          boolean smsdone = false;
          boolean calldone = false;
          int blocksize = 256;
          @Override
          protected Void doInBackground(Void... params) {
              //isRecording = true;
              try {
                  BufferedOutputStream dos = new BufferedOutputStream(new FileOutputStream(babyNoiseFile));
                  DataOutputStream dosTemp = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(babyNoiseTempFile)));
  
  
                  int bufferSize = AudioRecord.getMinBufferSize(frequency,channelConfiguration, audioEncoding);
                  AudioRecord audioRecord = new AudioRecord(MediaRecorder.AudioSource.MIC, frequency,channelConfiguration, audioEncoding, bufferSize);
  
                  short[] buffer = new short[bufferSize];
                  audioRecord.startRecording();
  
                  while (isMonitoringStarted) {
                      int bufferReadResult = audioRecord.read(buffer, 0,bufferSize);
  
                      //for (int i = 0; i &lt; buffer.length; i++) {
                      for (int i = 0; i &lt; bufferReadResult; i++) {
  
                          prgrssbarNoiseStatus.setProgress(buffer[i]);
                          lastlevel = buffer[i];
                          //txtvwProgress.setText(""+lastlevel);
                          //System.out.println(lastlevel);
                          if (lastlevel &gt; lowSensitivityLevel &amp;&amp; lastlevel &lt; mediumSensitivityLevel){
                              dos.write(buffer[i]);
                              publishProgress();
                              break;
                          } 
                          if (lastlevel &gt; mediumSensitivityLevel &amp;&amp; lastlevel &lt; highSensitivityLevel) {
                              dos.write(buffer[i]);
                              publishProgress();
                              break;
                          }
                          if (lastlevel &gt; highSensitivityLevel) {
                              dos.write(buffer[i]);
                              publishProgress();
                              break;
                          }
  
                      }
                      for (int i = 0; i &lt; bufferReadResult; i++) {
                          dosTemp.writeShort(buffer[i]);
  
                      }
                      //publishProgress(new Integer(r));
                  }
                  audioRecord.stop();
                  if (isMonitoringStarted) {
  
                  }
                  dos.close();
                  dosTemp.close();
              } catch (Throwable t) {
                  t.getStackTrace();
                  t.printStackTrace();
                  Log.e("AudioRecord", "Recording Failed");
              }
              return null;
          }
  
          protected void onProgressUpdate(Void... progress) {
  
              if (lastlevel &gt; lowSensitivityLevel &amp;&amp; lastlevel &lt; mediumSensitivityLevel) {
                  //islowFired = false;
                  System.out.println("low");
                  if (!islowFired) {
                      islowFired = true;
                      lowTimer = new LowActionTimer(2000, 1000);
                      lowTimer.start();
                  }
  
                  //Toast.makeText(HomeActivity.this, "Call will fire!!", Toast.LENGTH_SHORT).show();
              }
              if (lastlevel &gt; mediumSensitivityLevel &amp;&amp; lastlevel &lt; highSensitivityLevel) {
                  //if (islowFired) {
                  lowTimer.cancel();
                  mediumTimer = new MediumActionTimer(2000, 1000);
                  mediumTimer.start();
                  //}
                  //Toast.makeText(HomeActivity.this, "email will fire!!", Toast.LENGTH_SHORT).show();
                  System.out.println("medium");
              }
              if (lastlevel &gt; highSensitivityLevel) {
                  //Toast.makeText(HomeActivity.this, "notification will fire!!", Toast.LENGTH_SHORT).show();
                  System.out.println("call will fire!!");
              }
  }
          protected void onPostExecute(Void result) {
  
          }
      }
  </code></pre>
  
  <p>Thanks in adavance.</p>