title: Converting a byte array to .wav file in Android
body: <p>Working on trying to translate a byte array into a new .wav file in Android Studio.</p>
  
  <p>I originally take a .wav file and transform it into a byte array to do some signal processing on the wav (filtering). Then I intend on transforming it back into a .wav file for audio outputting.</p>
  
  <p>Since I am working in Android Studio I cannot easily use the AudioInputStream or .write classes/methods in Java.</p>
  
  <p>So my main question is HOW do you go from a byte array to a .wav file.</p>
  
  <p>Here is what I have so far:
  Code to transform the .wav file into a byte array:</p>
  
  <pre><code>ByteArrayOutputStream out;
  out = new ByteArrayOutputStream();
  InputStream in = this.getResources().openRawResource(R.raw.car); //references the wav file to in
  int read;
  byte[] buff = new byte[2000000];
  
      try {
          while ((read = in.read(buff)) &gt; 0)
          {
              out.write(buff, 0, read);//reads the wav file and places it inside in
          }
      } catch (IOException e1) {
          // TODO Auto-generated catch block
          e1.printStackTrace();
      }
      try {
          out.flush();
      } catch (IOException e1) {
          // TODO Auto-generated catch block
          e1.printStackTrace();
      }
  
      //creates a byte Array and stores it into audioBytes
      byte[] audioBytes = out.toByteArray();
  
  /*
  code to do signal processing on byte array
  */
  /*
  code to transform the byte array BACK into a .wav file
  */
  </code></pre>