Python high-level interface and ctypes-based bindings for PulseAudio (libpulse). Version 24.12.0 provides an object-oriented wrapper for controlling PulseAudio volume, sinks, sources, and more.
pip install pulsectlVerified import paths — ran on the pinned version, not inferred.
Connect to PulseAudio, list sinks, and set volume.
Use Pulse('app-name') with PulseAudio autodetection. Do not pass server string.Replace pulse.sink_input_set_volume(index, volume) with pulse.volume_set_all_chans(sink_input, volume).
Ensure PulseAudio is running (pulseaudio --start) or handle PulseError gracefully.
Use values in [0.0, 1.0] scale, e.g., 0.5 for 50% volume.
Start PulseAudio with 'pulseaudio --start' or set PULSE_SERVER environment variable.
Run 'pip install --upgrade pulsectl' and use 'from pulsectl import Pulse'.
Forward PulseAudio socket with '-v /run/user/$(id -u)/pulse:/run/user/$(id -u)/pulse' or set PULSE_SERVER=tcp:host:port.