Python Core Audio Windows Library
Actively maintained. Last release 2 months ago, commits in 11 of the last 26 weeks. A safe choice.
pip install pycawPycaw (Python Core Audio Windows)
Pycaw is a Python library designed exclusively for controlling audio devices on Windows systems. It allows programmatic access to audio sessions, volume control, and sound device management on the Windows platform.
Note: Pycaw does not support macOS or Linux. It is built specifically for Windows using Core Audio APIs. If you're looking for similar functionality on other platforms, you'll need alternative libraries.
Pycaw currently supports Python 3.10 through 3.14 on Windows. Supported Python versions are stable, non-EOL releases that have passed the project's Windows test matrix; newer Python releases are added after compatibility validation.
Install
Latest stable release:
pip install pycaw
Development branch:
pip install https://github.com/AndreMiras/pycaw/archive/main.zip
System requirements:
choco install visualcpp-build-tools
Usage
from pycaw.pycaw import AudioUtilities
device = AudioUtilities.GetSpeakers()
volume = device.EndpointVolume
print(f"Audio output: {device.FriendlyName}")
print(f"- Muted: {bool(volume.GetMute())}")
print(f"- Volume level: {volume.GetMasterVolumeLevel()} dB")
print(f"- Volume range: {volume.GetVolumeRange()[0]} dB - {volume.GetVolumeRange()[1]} dB")
volume.SetMasterVolumeLevel(-20.0, None)
# or work with the 0-100 scale the Windows volume mixer uses:
print(f"- Volume: {device.volume_percent:.0f}%")
device.volume_percent = 50