title: Resampling WasapiLoopbackCapture
body: <p>I'm trying to resample the WasapiLoopbackCapture's output from my soundcards <code>44100Hz, 16bit, 2 channel</code> waveformat to a <code>16000Hz, 16bit, 1 channel</code> format for later use in a <code>System.Net.Sockets.NetworkStream</code> (I want to write the converted bytes to the network stream)</p>
  
  <p>But I have no idea how to start even!
  I'm really new to signal processing and I've tried searching for tutorials but I just can't wrap my head around how to do this.</p>
  
  <p>Here's what I got so far:</p>
  
  <pre><code>void StartRecording()
  {
     capture = new WasapiLoopbackCapture(device); //  device is an audiodevice picked from the user. speaker, headphones etc
     capture.ShareMode = NAudio.CoreAudioApi.AudioClientShareMode.Shared;
     capture.DataAvailable += capture_DataAvailable;
     capture.RecordingStopped += capture_RecordingStopped;
     capture.StartRecording();
  }
  
  void capture_DataAvailable(object sender, WaveInEventArgs e)
  {
     outputStream.Write(e.Buffer, 0, e.BytesRecorded); // here I want to output audio to the NetworkStream.
     // But I have to resample it first, which brings me to my question.
  }
  </code></pre>
  
  <p>What I basically want to know is how I can get a byte-array which has been resampled and ready to be shipped off to the other side of the networkstream!
  Any suggestions are really appreciated! Thank you in advance.</p>