Question

Can NAudio be used for setting the volume level of a specific application? { Over Windows 7 }

I've found this thread, referring to the issue, suggesting to self-implement the required solution over WASAPI, but I'd prefer a simpler solution, optimally - using NAudio wrappers for this, if there are such.

I have also found this WASAPI-based solution, which (for me, over 32-bit Windows 7 Professional) does not enumerate all audio-playing applications, and is hence - not applicable.

What I'm actually trying to accomplish: I'm using a commercial application playing a long sequence of audio files, of various qualities and audio-levels. I'd like to apply AGC (Automatic Gain Control, i.e. volume-level normalization) to that application, to at least "blur" (if not eliminate altogether) the difference in volume-level between played tracks.

As a 1st phase, I could assume that this application is the only one producing audio on system, and handle only Windows' main audio-path samples, but I do not know how to accomplish that either. Can NAudio interfere with the audio-path, modifying audio-samples (i.e. amplifying them) before they reach the speakers jack?

Please note that simply changing Windows main volume gauge won't do the trick, as it won't be reflected in the amplitude of the samples captured by NAudio/WASAPI Loopback.

NAudio would be the preferred approach, but is NOT a must.

Was it helpful?

Solution

NAudio does have wrappers for many parts of the Windows Core Audio API, but does not include the [IAudioSessionEnumerator][1] that Roman mentions in the answer you linked to. It seems this part of the API was introduced with Windows 7.

So I'm afraid NAudio can't help you here, and you'd need to port Roman's code to C#, which would require you to create interop wrappers for IAudioSessionEnumerator and related interfaces such as IAudioSessionManager and IAudioSessionControl.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top