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.
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.
Need to be able to play parts of this buffer while still capturing, e.g.:
@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.
I should be able to start playing a sound that hasn't finished writing yet:
@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.
Need to be able to mask out parts of played-back buffer, e.g.:
bufferMaskStep = 1 //seconds
bufferMask = [1, 0, 0.5, 1, 0.1] //the volumes at each time step
Buffer.Play(20, 25, bufferMask, bufferMaskStep)
I see that NAudio offers WaveStream
, but apparently WaveStream.Write
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.
The gist of what I'm doing is making a loop pedal.