Skip to content

Latest commit

 

History

History
53 lines (39 loc) · 1.72 KB

README.md

File metadata and controls

53 lines (39 loc) · 1.72 KB

Pycaw (Python Core Audio Windows)

Tests Coverage Status PyPI release PyPI version

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.

Install

Latest stable release:

pip install pycaw

Development branch:

pip install https://github.com/AndreMiras/pycaw/archive/develop.zip

System requirements:

choco install visualcpp-build-tools

Usage

from 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.

Tests

See in the tests directory.