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

WaveStream from Microphone

Jul 26, 2011 at 11:00 PM

I can't find an example that shows how to get a WaveStream from a microphone, only a WaveStream from a file using a WaveFileReader. I need to have volume meters that display the volume of your voice while recording so I need to stream directly from the microphone. Any ideas on how to do this?

Jul 27, 2011 at 8:34 AM

I'm not expert here, but I built a volume meter by a code like this:

  WaveIn waveIn = new WaveIn();            
  waveIn.BufferMilliseconds = 50;
  waveIn.DeviceNumber = 0;
  waveIn.WaveFormat = new WaveFormat(8000, 16, 1);
  waveIn.DataAvailable += waveIn_DataAvailable;
  waveIn.StartRecording();

  void waveIn_DataAvailable(object sender, WaveInEventArgs e)
  {
       //you can use e.Buffer , It has the stream data of WaveIn device
  }