1

Possible Duplicate:
How would you code an efficient Circular Buffer in Java or C#

Are there any examples or documentation around for how to use NAudio to record to a circular buffer?

Also, how about how to copy data from memory and store it into a wav file?

In this application, I need to be sampling the data to determine the start of an event, and then start recording 2 seconds before that event. So I figure the easiest way is to constantly be recording into a circular buffer. From there I can copy the data out to store in a file.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Bernie Hunt
  • 306
  • 4
  • 22
  • 1
    Look here: http://stackoverflow.com/q/590069/102937 – Robert Harvey Mar 07 '12 at 04:48
  • 2
    Since question is closed, I'll answer in a comment. NAudio contains a `CircularBuffer` class, and it is used by `BufferedWaveProvider`. This is most commonly used when you are recording audio - you feed the received bytes into the `BufferedWaveProvider`. See the NAudioDemo application chat or MP3 streaming demos for examples of this in action. – Mark Heath Mar 07 '12 at 20:02
  • I will also add, none of the circular buffer implementations in that other question would be a particularly good choice for raw audio data, since they assume you are adding and removing individual items at a time, whereas with audio you are likely to be adding and removing a few thousand bytes to your buffer in one go. – Mark Heath Mar 07 '12 at 20:05
  • Thanks Mark! Do you know of any examples of this in use on the net? Bernie – Bernie Hunt Mar 07 '12 at 21:39

0 Answers0