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

NAudio - Peak Meter in C#

Jan 17, 2012 at 5:32 PM
Edited Jan 17, 2012 at 5:32 PM



I've been searching for the better part of a week for this now and I see nothing, anywhere, showing me if and/or how I can do this using NAudio.

I guess my question would be: Can it be done? If so, can someone point me in the right direction?

I've searched Google for hours, CodePlex, old blogs, et cetera... nothing. It is of course ENTIRELY possible I've missed something somewhere or my search terms have just not been the best, but so many hours of looking.

Also, there is a problem with the recording example (which I tried to use to detect if sound is playing) given on a blog and on this forum. When you fire up the example, it errors out with a message about the wav already being used, so it cannot access it. Is that example just extremely old or is something else wrong? The sample program works fine, but building it and running it myself produces that problem.

Anyway, thanks in advance for any insight.

Jan 17, 2012 at 5:36 PM

NAudio comes with a project called NAudioDemo, that shows how to implement a peak meter during playback, as well as how to record. Have a play with the demo application, and then browse the source code for NAudioDemo (available here), to see how it is implemented.

Jan 17, 2012 at 5:48 PM

Thanks for a quick reply.

I will give it another look (can't compile any of it, it gives tons of errors VS 2010) and reply back if I find a solution.

Jan 17, 2012 at 6:18 PM

Okay... found what I needed.

Any hints on how to make this work globally instead of just with a file? I'd like to see the peak meter for every sound that plays... I am thinking just setting up a record session for the system's wave device or stereo mix device?


Jan 17, 2012 at 7:34 PM

A good place to look for peak metering on a recording stream is my app. It's WPF, but the principle is essentially the same.

May 4, 2012 at 2:03 PM


I have create my own application and i have to add volume meter in my application when an audio is playing, i used ur code but it was not working... Can u please help me where are u getting value for the amplitude????

Thanks in advance...

May 8, 2012 at 9:46 AM

that project uses a MeteringWaveProvider that examines the samples as they come through the Read method and raises events with peak values