C#マイクメインピーク(リアルタイムの音声出力デシベルの量)を取得します

1.参照ライブラリNAudio、Gitのアドレス  https://github.com/naudio/NAudio

2.次のコードと参照を追加します。

公共フロートGetVoicePeakValue()
{
=新しいMMDeviceEnumerator VAR列挙子()。
VaRのCaptureDevicesの=のenumerator.EnumerateAudioEndPoints(DataFlow.Capture、DeviceState.Active).ToArray();
VAR defaultDevice = enumerator.GetDefaultAudioEndpoint(DataFlow.Capture、Role.Console)。
VaRのselectedDevice = CaptureDevices.FirstOrDefault(C => c.ID == defaultDevice.ID)。
selectedDevice.AudioMeterInformation.MasterPeakValueを返します。
}

 

おすすめ

転載: www.cnblogs.com/Khan-Sadas/p/11427678.html