Registry / communication / pycaw
library20251023pypypiunverified

Python Core Audio Windows Library - control and manage Windows audio devices, sessions, and endpoints. Current version 20251023, released annually.

pip install pycaw
INSTALL
IMPORT
SIG · PYCAW
P
pycaw
communicationpythonv20251023
Install
2.0s avg
Import
—
Disk
20MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v20251023 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 21.2MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 2.0s · import 0.000s · 22MB
20MB installed
● package 20MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AudioUtilities
✓ from pycaw import AudioUtilities
✗ from pycaw.pycaw import AudioUtilities

Set master volume to 50% using pycaw.

from pycaw.pycaw import AudioUtilities def set_volume(volume_level): devices = AudioUtilities.GetSpeakers() interface = devices.Activate( AudioUtilities.IID_IAudioEndpointVolume, 1, None) from pycaw.api.endpointvolume import IAudioEndpointVolume volume = interface.QueryInterface(IAudioEndpointVolume) volume.SetMasterVolumeLevelScalar(volume_level, None) if __name__ == "__main__": set_volume(0.5) print("Volume set to 50%")
Debug
Known issues
breakingDouble free crash due to using `cast` instead of `QueryInterface` for COM interfaces. Fixed in v20240210 but code using `cast(py_object, ...)` on older versions may crash.
fix
Use `QueryInterface(InterfaceClass)` instead of `cast(py_object, interface)`.
affects: < v20240210
breakingIn v20210516, the `pycaw.pycaw` module was reorganized into subpackages. Code that imported `AudioUtilities` from `pycaw` directly broke.
fix
Change imports to `from pycaw.pycaw import AudioUtilities`.
affects: >= v20210516
gotchapycaw only works on Windows. Importing on Linux/Mac will raise `ModuleNotFoundError` for comtypes or runtime errors.
fix
Wrap imports with `if sys.platform == 'win32':` or use a try/except for `ModuleNotFoundError`.
affects: all
gotchaMemory leaks from `PROPVARIANT` objects in older versions. Fixed in v20230407, but code that creates many `PROPVARIANT` instances without cleanup may still leak.
fix
Update to v20230407 or later, and ensure PROPVARIANT objects are freed.
affects: < v20230407
Upgrade
Version history
20251023latest on PyPI · released Oct 23, 2025
Audit
Dependencies
comtypesrequiredCore dependency for COM interop on Windows
Agent activity
28 hits · last 30 days
node
24
Amazon
2
OpenAI (training)
1
Resources
pycaw — pip install pycaw · libregistry