Python Core Audio Windows Library, working for both Python2 and Python3.
Latest stable release:
pip install pycawDevelopment branch:
pip install https://github.com/AndreMiras/pycaw/archive/develop.zipSystem requirements:
choco install visualcpp-build-toolsfrom comtypes import CLSCTX_ALL
from pycaw.pycaw import AudioUtilities, IAudioEndpointVolume
devices = AudioUtilities.GetSpeakers()
interface = devices.Activate(
IAudioEndpointVolume._iid_, CLSCTX_ALL, None)
volume = interface.QueryInterface(IAudioEndpointVolume)
volume.GetMute()
volume.GetMasterVolumeLevel()
volume.GetVolumeRange()
volume.SetMasterVolumeLevel(-20.0, None)See more in the examples directory.
See in the tests directory.
you can now get sessions from all audio devices, not just from your default
for this use
AudioUtilities.GetSessionsFromAllDevices()for this to work I also added
AudioUtilities.GetAllAudioSessionManagers()and
AudioUtilities.GetAllSpeakers()therefor you can now controll not only the default but also all other audio cannels