Audio level meter for NAudio recording

别来无恙 提交于 2019-12-06 04:10:38

For a Windows Forms example, have a look at the NAudioDemo source code and in particular the AudioPlaybackPanel class, which uses a MeteringSampleProvider and subscribes to its StreamVolume event to set the properties on a custom volume meter control (included in NAudio)

For a WPF example, look at voicerecorder.codeplex.com which uses a similar technique and the volume metering is described in this article.

I wrote a control that does everything you want to control can be found here.

For use with NAudio is sufficient to define a device as:

Private NAudio.CoreAudioApi.MMDevice device;

then at any time you know the value of the audio levels of the following values:

Master :

device.AudioMeterInformation.MasterPeakValue;

Left :

device.AudioMeterInformation.PeakValues[0];

Right :

device.AudioMeterInformation.PeakValues[1];
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!