This project has moved and is read-only. For the latest updates, please go here.

WaveIn - questions

May 30, 2010 at 11:00 AM

Hi Mark 

Thank you for making NAudio available. 

I have a couple of questions to get the best out of it.  Many thanks indeed for your time if you manage to take a look.

1.  How should I use WaveBuffer correctly?  When I run the following code e.BytesRecorded will be something like 9600, while wavebuffer.ByteBufferCount is always 0.  Am I missing something?

        void waveIn_DataAvailable(object sender,WaveInEventArgs e)
            WaveBuffer wavebuffer = new WaveBuffer(e.Buffer);
            tbBytes.Text = wavebuffer.ByteBufferCount.ToString();
            //tbBytes.Text = e.BytesRecorded.ToString();

2.  When setting up WaveIn, what is the effect of changing the Number of Buffers, e.g.

waveIn.NumberOfBuffers = 5;
May 30, 2010 at 11:01 AM

I should have said, Windows 7 64bit, Visual Studio Express 2010

Jun 1, 2010 at 1:34 PM

1. ByteBufferCount is not calculated automatically - it needs to be set manually if you want to use it. Just set it to e.BytesRecorded

2. Normally you use 2 buffers. One is being filled up, while the other is being processed. You can use 3 if you think your app might struggle to always finish processing a buffer in the length of time that the other one is being used. It matters more for WaveOut, as it allows you to get ahead of yourself and avoid playback glitches, at the expense of having higher latency.


Jun 7, 2010 at 9:15 PM

Can some one help me write in C# how can I record with Naudio (or other ...) only sound entering by Micro Line and not other sound