Search code examples
c#.netnaudiosoundcard

NAudio UI volume meter


Is there a way to subscribe periodics events in order to get a reduced sample from audio output? I'd like to design a volume meter and I don't want use timers. I only need a visual feedback on my volume indicator.

Other solutions would be welcome.


Solution

  • You can use a MeteringSampleProvider for this purpose. As the documentation says:

    Simple SampleProvider that passes through audio unchanged and raises an event every n samples with the maximum sample value from the period for metering purposes