I'm looking for a simple way to get windows' master volume in Python. Preferably a function that simply returns the master volume.
Something like this:
GetMasterVolume()
#0.3
I'm looking for a simple way to get windows' master volume in Python. Preferably a function that simply returns the master volume.
Something like this:
GetMasterVolume()
#0.3
On Windows, use pycaw:
from ctypes import cast, POINTER
from comtypes import CLSCTX_ALL
from pycaw.pycaw import AudioUtilities, IAudioEndpointVolume
devices = AudioUtilities.GetSpeakers()
interface = devices.Activate(IAudioEndpointVolume._iid_, CLSCTX_ALL, None)
volume = cast(interface, POINTER(IAudioEndpointVolume))volume.GetMasterVolumeLevelScalar()