Search code examples
c#audiowindows-10speaker

Control left & right speaker balance level on Windows 10 using C#


I need to control the left & right speaker balance level on Windows 10 using my C# application.

I was able to control the master volume level of speaker and microphone using Windows IAudioEndpointVolume interface through the Audio Manager C# wrapper which is also mentioned in http://stackoverflow.com/questions/14306048/controling-volume-mixer.

But still, I'm unable to control the L/R balance. Is there any specific interface or property I should use?

windows-audio-speaker-balance settings

I'm building Console Application using Windows 10 SDK & .NET 4.6.1 framework through Visual Studio 15


Solution

  • Use SetChannelVolumeLevel (or SetChannelVolumeLevelScalar) method from IAudioEndpointVolume.

    SetChannelVolumeLevel: https://learn.microsoft.com/en-us/windows/desktop/api/endpointvolume/nf-endpointvolume-iaudioendpointvolume-setchannelvolumelevel

    SetChannelVolumeLevelScalar: https://learn.microsoft.com/en-us/windows/desktop/api/endpointvolume/nf-endpointvolume-iaudioendpointvolume-setchannelvolumelevelscalar