title: Sox - Piping output in windows
body: <p>So I am emulating a RP2A03 chip using C++, using SoX to resample and output the audio.</p>
  
  <p>I can confirm that the APU itself and input pipe is working as a charm with the command following command:</p>
  
  <pre><code>FILE* fp = popen(".\\sox\\sox.exe -t raw -c1 -e signed-integer -b 16 -r1789800 - -t wav -c2 -r 48000 wav.wav", "wb");
  ...
  fputc(sample, fp);
  fputc(sample/256, fp);
  </code></pre>
  
  <p>Which outputs a beautiful chiptune as wav.wav, playable in MS-media player, VLC and alike.</p>
  
  <p>But when I try to pipe the music to ffplay using:</p>
  
  <pre><code>FILE* fp = popen(".\\sox\\sox.exe -t raw -c1 -e signed-integer -b 16 -r1789800 - -t raw -c2 -r 48000 - | .\\sox\\ffplay.exe -acodec pcm_s16le -", "wb");
  </code></pre>
  
  <p>I get an error reading:</p>
  
  <pre><code>FAIL sox: `-' error writing output file: Invalid argument
  </code></pre>
  
  <p>I've been hard at google for hours with no luck...</p>
  
  <p>I've been stuck at this for hours, since yesterday actually, and it seems like there is something crucial (or trivial?) I am overlooking, as all the examples I find use the same, or even easier methods, to write the output to stdout.</p>
  
  <p>As I can actually output it to a wav with no problems what so ever, I can't help but feel a bit taunted by the software...</p>
  
  <p>If anyone have any suggestions that might help, then please, please share!</p>
  
  <p>Thanks!</p>