title: Reproduce PIPE functionality in IronPython
body: <p>I am hoping some genious out there can help me out with this...</p>
  
  <p>I am using sox to merge and resample a group of WAV files, and pipe the output directly to the input of NeroAACEnc for encoding to AAC format.</p>
  
  <p>I originally ran the process in a script, which included:</p>
  
  <pre><code>sox.exe d:\audio\1.wav d:\audio\2.wav d:\audio\3.wav -c 1 -r 22050 -t wav - | neroAacEnc.exe -q 0.5 -if - -of test.m4a
  </code></pre>
  
  <p>This worked as expected. The '-' in the comand line translates as 'Pipe/redirect input/output (stdin/stdout)' - So Sox pipes to stdout, and NeroAACEnc reads from stdin, the | joins them together.</p>
  
  <p>I then migrated the whole solution to Python, and the equivalent command became:</p>
  
  <pre><code>from subprocess import call, Popen, PIPE
  runwav = Popen(['sox.exe', 'd:\audio\1.wav', 'd:\audio\2.wav', 'd:\audio\3.wav', '-c', '1', '-r', '22050', '-t', 'wav', '-'], shell=False, stdout=PIPE)
  runm4b = call(['neroAacEnc.exe', '-q', '0.5', '-if', '-', '-of', 'test.m4a'], shell=False, stdin=runwav.stdout)
  </code></pre>
  
  <p>This also worked like a charm, exactly as expected. Slightly more convoluted, but hey :)</p>
  
  <p>Well now I have to move it to IronPython, and the Subprocess module isn't available (the partial implementation that is, doesn't have Popen/PIPE support - plus it seems silly to add a custom library when there is probably a native alternative). <strong>UPDATE</strong> The partial module DOES support Popen and PIPE, I mis-read it. It is possible to extract the specifics for the .net/IronPython solution from this module (see update below)</p>
  
  <p>I should mention here, that I opted for IronPython over C#, because I am comfortable with Python now - however, there is a chance of moving it again later to C# native, and I am using IronPython to ease myself into it :) I have no C# or .net experience.</p>
  
  <p>So far I have the following equivalent, that sets up the 2 processes:</p>
  
  <pre><code>from System.Diagnostics import Process
  wav = Process()
  wav.StartInfo.UseShellExecute = False
  wav.StartInfo.RedirectStandardOutput = True
  wav.StartInfo.FileName = 'sox.exe'
  wav.StartInfo.Arguments = 'd:\audio\1.wav d:\audio\2.wav d:\audio\3.wav -c 1 -r 22050 -t wav -'       
  wav.Start()
  
  m4b = Process()
  m4b.StartInfo.UseShellExecute = False
  m4b.StartInfo.RedirectStandardInput = True
  m4b.StartInfo.FileName = 'neroAacEnc.exe'
  m4b.StartInfo.Arguments = '-q 0.5 -if - -of test.m4a'
  m4b.Start()
  </code></pre>
  
  <p>I know that these 2 processes start (I can see Nero and Sox in the task manager) but what I can't figure out (for the life of me) is how to string the two output/input streams together, as with the previous two solutions. I have searched and searched, so I thought I'd ask!</p>
  
  <p>If anyone knows either:</p>
  
  <ol>
  <li>How to join the two streams with the same net result as the Python and Commandline versions; or</li>
  <li>A better way to acheive what I am trying to do.</li>
  </ol>
  
  <p>P.S. A code sample based off the above would be awesome :) or a specific code example of a similar process that I can easily translate.</p>
  
  <p>[UPDATE]</p>
  
  <p>After consideration, I resolved to handle my particular scenario as two seperate processes; outputting the merged WAVs to a file, then using that file as the input for the conversion.</p>
  
  <p>However, it is possible to acheive what I wanted, using the subprocess module available <a href="http://www.mail-archive.com/users@lists.ironpython.com/msg05495.html" rel="nofollow">here</a>.</p>