title: Can I write and play from a audio stream buffer at the same time (in NAudio)?
body: <p>I have been pointed towards NAudio as possibly allowing me to do this. However, if it cannot, I would appreciate suggestions of libraries that can. I am currently working in C#/WPF, but comfortable calling other C/C++ libraries.</p>
  
  <p>I am receiving a continuous buffer of audio samples (mono). Type: 16-bit signed integer. Rate: 16 kHz.
  I will need to hold 1-2 hours of buffer data (230 MB). I want to save this buffer to disk so I can retrieve it later.</p>
  
  <p>Need to be able to play parts of this buffer while still capturing, e.g.: </p>
  
  <pre><code>@0s, Buffer.StartRecording()
  @30s, handle = Buffer.Play(20,25) //Plays the buffer from 20 - 25 s
  @50s, handle1 = Buffer.Play(20,25)
  @51s, handle2 = Buffer.Play(20,25) //Playing two parts of the buffer at the same time.
  @52s, handle1.Stop() //Buffer1 stops playing after having played for 2 seconds.
  </code></pre>
  
  <p>I should be able to start playing a sound that hasn't finished writing yet:</p>
  
  <pre><code>@0s, Buffer.StartRecording()
  @25s, handle = Buffer.Play(20,30) //Plays the buffer from 20 - 30 s
  @30s, //Buffer has played halfway through (currently, play marker is at 25 s
  @35s, //Buffer playing finishes.
  </code></pre>
  
  <p>Need to be able to mask out parts of played-back buffer, e.g.:</p>
  
  <pre><code>bufferMaskStep = 1 //seconds
  bufferMask = [1, 0, 0.5, 1, 0.1] //the volumes at each time step
  Buffer.Play(20, 25, bufferMask, bufferMaskStep)
  </code></pre>
  
  <p>I see that NAudio offers <code>WaveStream</code>, but apparently <code>WaveStream.Write</code> is not supported. I could manage appending to a byte buffer myself, and copy sections out of it when I want to play them, but I am wondering if there is an out-of-the-box solution.</p>
  
  <p>The gist of what I'm doing is making a loop pedal.</p>