Answer the question
In order to leave comments, you need to log in
How to get the current sound level and its status?
You need to somehow get the current sound level and its state (on / off). How can this be implemented? Windows, Python3.
Answer the question
In order to leave comments, you need to log in
Try the pycaw library . Here is an example of its use:
pip install 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.GetMute()
volume.GetMasterVolumeLevel()
volume.GetVolumeRange()
volume.SetMasterVolumeLevel(-20.0, None)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question