{"id":21718,"library":"pulsectl","title":"pulsectl","description":"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.","status":"active","version":"24.12.0","language":"python","source_language":"en","source_url":"https://github.com/mk-fg/python-pulse-control","tags":["pulseaudio","audio","volume","mixer","bindings"],"install":[{"cmd":"pip install pulsectl","lang":"bash","label":"Install via pip"}],"dependencies":[{"reason":"Optional dependency for type hints in Python <3.11","package":"typing_extensions","optional":true}],"imports":[{"note":null,"wrong":null,"symbol":"Pulse","correct":"from pulsectl import Pulse"},{"note":null,"wrong":null,"symbol":"PulseVolumeInfo","correct":"from pulsectl import PulseVolumeInfo"}],"quickstart":{"code":"from pulsectl import Pulse\n\nwith Pulse('my-app') as pulse:\n    sink_list = pulse.sink_list()\n    for sink in sink_list:\n        print(sink.description, sink.volume)\n    # Set volume of first sink\n    if sink_list:\n        pulse.volume_set_all_chans(sink_list[0], 0.5)","lang":"python","description":"Connect to PulseAudio, list sinks, and set volume."},"warnings":[{"fix":"Use Pulse('app-name') with PulseAudio autodetection. Do not pass server string.","message":"in version 24.12.0, the 'Pulse' context manager no longer uses pulseaudio server string; removed deprecated 'connect_to_server' method.","severity":"breaking","affected_versions":">=24.0.0"},{"fix":"Replace pulse.sink_input_set_volume(index, volume) with pulse.volume_set_all_chans(sink_input, volume).","message":"The 'sink_input_set_volume' method is deprecated; use 'volume_set_all_chans' on sink input objects.","severity":"deprecated","affected_versions":">=20.0.0"},{"fix":"Ensure PulseAudio is running (pulseaudio --start) or handle PulseError gracefully.","message":"Running without a running PulseAudio server or inside a Docker container will raise a PulseError.","severity":"gotcha","affected_versions":"all"},{"fix":"Use values in [0.0, 1.0] scale, e.g., 0.5 for 50% volume.","message":"Volume values are floats between 0.0 and 1.0 (or greater for pa_volume_t range), not percentages or decibels.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Start PulseAudio with 'pulseaudio --start' or set PULSE_SERVER environment variable.","cause":"PulseAudio server not running or socket not accessible.","error":"pulsectl.PulseError: Failed to create mainloop: No such file or directory"},{"fix":"Run 'pip install --upgrade pulsectl' and use 'from pulsectl import Pulse'.","cause":"Installed old version (<3.0) or import of wrong module.","error":"AttributeError: module 'pulsectl' has no attribute 'Pulse'"},{"fix":"Forward PulseAudio socket with '-v /run/user/$(id -u)/pulse:/run/user/$(id -u)/pulse' or set PULSE_SERVER=tcp:host:port.","cause":"PulseAudio native protocol socket is not listening (e.g., in container without shared socket).","error":"pulsectl.PulseError: Connection refused"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}