gingerbreadboy
gingerbreadboy

Reputation: 7759

C# tutorial for "listening" to the line in device

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,

Upvotes: 2

Views: 4686

Answers (3)

Mark Heath
Mark Heath

Reputation: 49512

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

Upvotes: 2

Tamás Szelei
Tamás Szelei

Reputation: 23961

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.

Upvotes: 2

Eilon
Eilon

Reputation: 25704

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.

Upvotes: 3

Related Questions