Search code examples
c#audionaudio

Listen to WaveOutDevice


After choosing a waveout device I want to listen to it every second in order to monitor its volume. How do I go about doing this? I have not found any example regarding listening to a playback device output.

int waveOutDevices = WaveOut.DeviceCount;
for (int i = 0; i < waveOutDevices; i++)
{
    WaveOutCapabilities deviceInfo = WaveOut.GetCapabilities(i);
    Console.WriteLine("Device {0}: {1}, {2} channels", i, deviceInfo.ProductName, deviceInfo.Channels);
}

Solution

  • This isn't something supported by the WaveOut APIs. If you are on Vista or above you can use WasapiLoopbackCapture to intercept the audio from any render device, and WASAPI also supports signing up for volume notifications which would be ideal for our scenario.