Search code examples
c#.netmicrophonenaudio

How do I know when the sound to microphone is begin?


I have one problem. How do create program, that throw exception, while begin sound in microphone. Microphone always on, that is noise is always too. Roughly, if I speak to microphone, program throw exceprion. I'm using NAudio. Please help


Solution

  • Look at the WaveInStream class in NAudio. It allows you to open microphone and receive events containing the latest captured bytes. Processing captured bytes allows to understand if sound began or did not began.