Getting audio peak meter values for all active audio sessions

The Windows Vista volume mixer shows a peak meter for the device.  In Windows 7 we added a peak meter for each application.

The audio interface for both is IAudioMeterInformation; I've used this before in my post about the linearity of Windows volume APIs.  This post showed how an application can get the peak meter reading for the device meter.

In Windows 7 we also added APIs to allow applications to get a list of audio sessions.  I wrote up a quick app which shows how to get a list of all audio sessions, filter it down to the active ones (sessions which have an active audio client), and then get a peak meter reading.

{}.{c05f2f54-7294-422a-bb0d-8d690c365b73}|#%b{917F8618-9C57-4720-9B7C-88CA45FC983B}: 0.215705
Active sessions: 1

{}.{c05f2f54-7294-422a-bb0d-8d690c365b73}|#%b{917F8618-9C57-4720-9B7C-88CA45FC983B} is the session identifier, which should be considered opaque.  0.215705 is the value of the peak meter, ranging from 0 to 1 linearly in amplitude.  If you are populating a visual peak meter with this information, you will need to apply a curve.

Source and binaries attached.  Pseudocode follows:

for (each session) {
    if the state is anything but "active", skip to the next session
    QI IAudioSessionControl to IAudioSessionControl2
    QI IAudioSessionControl to IAudioMeterInformation
    Log the session identifier and the peak value

EDIT September 22 2015: removed source and binaries as this is obsoleted by

Comments (7)

  1. kinokijuf says:

    Will a pseudolocalised MUI be released for Windows?

  2. Can not run on vista, for I****2 interfaces supported since win 7.

    but how to do it on vista?

  3. Cannot run in Win7, say "not a valid win32 application" says:

    Cannot run in Win7, say "not a valid win32 application"

    do you have the same error?

  4. Are you maybe running the amd64 .exe on an x86 install of Windows 7?

  5. Jimmy Zhao says:


    it works now.

Skip to main content