tags:

views:

135

answers:

3

I know the obvious answer is "try google..." but i have and I either end up with graphics or cmd-line tutorials, so...

Can anyone point I in the direction of a c# tutorial for "listening" to the audio line-in? Or is it straight forward with the right namespace included? Is it even possible without using directx or some such.

I want to detect external audio activity and report it on screen.

Cheers,

+2  A: 

This code sample looks like it has everything that you need: VolumeMeter

Presumably you just need to change the code so that instead of rendering the current volume levels you could return a flag indicating whether "something" is going on.

It's using the Managed DirectX library, which is a managed code wrapper for the native DirectX APIs.

Eilon
+1  A: 

You need an external library to do that. These have .NET bindings:

  • FMOD is widely used in games, and has an opensource license (and a paid one).
  • BASS Audio Library is another choice. It's a bit more lightweight.
  • IrrKlang I haven't use this one, but I was told it is worth the money
  • NAudio I found just now, because I forgot the IrrKlang's name, and had to google for it. This one looks promising.

OR MDX can do this I think.

Tamás Szelei
+1  A: 

check out the VoiceRecorder sample application on Codeplex which shows how to do this using NAudio. This Coding4Fun article explains it in more detail.

Mark Heath