title: Create valid wav file header for streams in memory
body: <p>I have raw-headerless <strong>wav</strong> audio data as <code>MemoryStream</code>s.</p>
  
  <pre><code>Stream rawAudioStream = Producer.GetRawAudioFileStream(...);
  </code></pre>
  
  <p>I know those streams data format:</p>
  
  <pre><code>// WaveFormat(int rate, int bits, int channels);
  WaveFormat waveformat = new WaveFormat(8000, 16, 1);
  </code></pre>
  
  <p>What I want is to add programmatically right header info for those memory streams without writing them to a physical file. </p>
  
  <p>How can I do that?</p>
  
  <p><strong>PS:</strong> I checked the NAudio Library but only found a way to create a header by writing streams to really-physical files which is <strong>not suitable for my situation</strong>.</p>
  
  <pre><code>var waveformat = new WaveFormat(8000,16,1);
  
  var reader = new RawSourceWaveStream(rawAudioMemStream, waveformat);
  
  using (var convertedStream = WaveFormatConversionStream.CreatePcmStream(reader))    
  {
      WaveFileWriter.CreateWaveFile(fileName, convertedStream);     
  }
  
  rawAudioMemStream.Close();
  </code></pre>