(Sep-30-2016, 07:33 PM)Lightningwalrus Wrote: How do I change this code so I can change the sound volume on my computer ? I use windows 7.The library nilamo posted should solve it.
Now I'm not sure if I can pull it off at all. This seem very complicated :O
Test controlling volume on my laptop Win-10.
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)) # Control volume #volume.SetMasterVolumeLevel(-0.0, None) #max #volume.SetMasterVolumeLevel(-5.0, None) #72% volume.SetMasterVolumeLevel(-10.0, None) #51%