title: Android when I try to merge 2 waves files the output contains only the first wave
body: <p>I am working on android. I want to merge two wave files and want to create a third file. For this, I create two input streams and then trying to write those input streams into one output stream file. the result I get always contains just 1 of the two files and it ignores the second one</p>
  <p><strong>This is my code:-</strong></p>
  <pre><code>  try {
                        //first file
                  FileInputStream fis1 = new FileInputStream(recordPath+&quot;/test2.wav&quot;); 
                       //second file 
                  FileInputStream fis2 = new FileInputStream(recordPath+&quot;/test.wav&quot;);   
                      //concatenate the two files
                  SequenceInputStream sis = new SequenceInputStream(fis1,fis2);
                  FileOutputStream fos = new FileOutputStream(new File(recordPath+&quot;/finaloutput.wav&quot;)); 
                  int temp;
                  try {
                      while ((temp = sis.read())!= -1){
                          fos.write(temp);
                      }
                  } catch (IOException e) {
                      e.printStackTrace();
                  }
  </code></pre>