title: Mixing audio using SOX , sox FAIL formats: can't open input file `audio_recorded.wav': WAVE: RIFF header not found
body: <p>I want to mix audio using SOX in linux. This is my script.
  I'm a total beginner on this thing. </p>
  
  <pre><code>    time sox --buffer 128000 --combine mix audio1.mp3 audio_recorded.wav -C 64.0 "./Mixed.mp3"
      time ffmpeg -loglevel warning -i ./Output.wav -c:a libfdk_aac -b:a 64k -map 0:0 -f segment -segment_time 10 -segment_list ./Output.m3u8 -segment_format aac './stream%03d.aac'
  
      cd ..
  </code></pre>
  
  <p>but the result is like this..</p>
  
  <pre><code>    sox FAIL formats: can't open input file `audio_recorded.wav': WAVE: RIFF header not found
  
      real    0m0.003s
      user    0m0.000s
      sys     0m0.002s
  </code></pre>
  
  <p>The <code>audio_recorded.wav</code> is a recorded audio file from android.</p>
  
  <p>[REMOVED ANDROID CODE: no longer necessary]</p>
  
  <p>UPDATE: I have tried to revise my recorder..set bit rate and sample rate same to audio1.mp3.
  Then I tried to mix it. This is now what happens:</p>
  
  <pre><code>    [root@app complete]# bash test_mix.sh 
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: recoverable MAD error
      sox WARN mp3-util: recoverable MAD error
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: recoverable MAD error
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: recoverable MAD error
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: recoverable MAD error
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: recoverable MAD error
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: recoverable MAD error
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: recoverable MAD error
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: recoverable MAD error
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: recoverable MAD error
      sox WARN mp3-util: recoverable MAD error
      sox WARN mp3-util: recoverable MAD error
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: recoverable MAD error
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: recoverable MAD error
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: MAD lost sync
      sox WARN mp3-util: MAD lost sync
      sox FAIL formats: can't open input file `sound997309159.mp3': 
  
      real    0m0.005s
      user    0m0.002s
      sys     0m0.002s
  </code></pre>
  
  <p>I set the sample rate and bit rate of the recorded since when i tried mixing it in sox, it prompted me that the files dont have same channel and bit rate.</p>