tags:

views:

139

answers:

4

I am trying to create a program that will sit and wait until it picks up on any sound (i.e. a doorbell), and in response, triggers an event function that I can use to run some code.

My exact goal is to have it run wmplayer playing a sound of a dog barking whenever it picks up something as loud as a doorbell from the microphone input.

Thanks! --David

A: 

Please see CheckSilent method from http://alvas.net/alvas.audio,tips.aspx#tip73

alex
NOTE: This is a paid product. The free version has a modal popup on every application start.
Alastair Pitts
A: 

You could use Managed DirectX (e.g. http://www.codeproject.com/KB/directx/volumemeter.aspx) but availability will depend on which version of Windows you are targeting - as it has now been deprecated.

Hightechrider
A: 

NAudio would work for this and is relatively simple to use. Look at the NAudio WPF Demo provided with it for a good place to start at. There is also several tutorials on their home page.

Cornelius
A: 

I posted some very simple code that does frequency analysis in C# on the old Joel On Software forum back in 2005. You could probably adapt it to measure volume instead of frequency easily enough. Notice that it draws the waveform into a graphics element on the form and then deduces the frequency.

http://discuss.joelonsoftware.com/default.asp?joel.3.154243.12

Eric Lippert