Name | libpulse JSON |
Version |
0.5
JSON |
| download |
home_page | None |
Summary | Asyncio interface to the Pulseaudio and Pipewire pulse library. |
upload_time | 2024-11-03 07:04:44 |
maintainer | None |
docs_url | None |
author | None |
requires_python | <4,>=3.8 |
license | None |
keywords |
pulseaudio
pipewire
asyncio
ctypes
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
Asyncio interface to the Pulseaudio and Pipewire pulse library.
`libpulse`_ is a Python project based on `asyncio`_, that uses `ctypes`_ to
interface with the ``pulse`` library of the PulseAudio and PipeWire sound
servers. The interface is meant to be complete. That is, all the constants,
structures, plain functions and async functions are made available by importing
the libpulse module of the libpulse package.
It includes the ``pactl.py`` module, a Python implementation of the ``pactl``
command that runs both on Pulseaudio and Pipewire. The output of most
``pactl.py`` subcommands can be parsed by Python and when redirected to a file,
the file can be imported as a Python module. For example start an interactive
Python session and inspect the ``cards`` object with all its nested sructures
and dereferenced pointers with:
.. code-block:: shell
$ ./pactl.py list cards > cards.py && python -i cards.py
Calling an async function is simple:
.. code-block:: python
import asyncio
from libpulse.libpulse import LibPulse
async def main():
async with LibPulse('my libpulse') as lib_pulse:
sink = await lib_pulse.pa_context_get_sink_info_by_index(0)
print('sample_spec rate:', sink.sample_spec.rate)
print('proplist names:', list(sink.proplist.keys()))
asyncio.run(main())
Another example processing sink-input events:
.. code-block:: python
import asyncio
from libpulse.libpulse import LibPulse, PA_SUBSCRIPTION_MASK_SINK_INPUT
async def main():
async with LibPulse('my libpulse') as lib_pulse:
await lib_pulse.pa_context_subscribe(
PA_SUBSCRIPTION_MASK_SINK_INPUT)
iterator = lib_pulse.get_events_iterator()
async for event in iterator:
# 'event' is an instance of PulseEvent.
some_function_to_process_the_event(event)
asyncio.run(main())
See the libpulse `documentation`_.
Requirements
============
Python version 3.8 or more recent.
Installation
============
Install ``libpulse`` with pip::
$ python -m pip install libpulse
.. _libpulse: https://gitlab.com/xdegaye/libpulse
.. _asyncio: https://docs.python.org/3/library/asyncio.html
.. _ctypes: https://docs.python.org/3/library/ctypes.html
.. _documentation: https://libpulse.readthedocs.io/en/stable/
Raw data
{
"_id": null,
"home_page": null,
"name": "libpulse",
"maintainer": null,
"docs_url": null,
"requires_python": "<4,>=3.8",
"maintainer_email": null,
"keywords": "pulseaudio, pipewire, asyncio, ctypes",
"author": null,
"author_email": "Xavier de Gaye <xdegaye@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/24/ee/41fab371e89b5ffff5dcc9aa1f24d18b70b2a8f478048c47eb358ebfcab2/libpulse-0.5.tar.gz",
"platform": null,
"description": "Asyncio interface to the Pulseaudio and Pipewire pulse library.\n\n`libpulse`_ is a Python project based on `asyncio`_, that uses `ctypes`_ to\ninterface with the ``pulse`` library of the PulseAudio and PipeWire sound\nservers. The interface is meant to be complete. That is, all the constants,\nstructures, plain functions and async functions are made available by importing\nthe libpulse module of the libpulse package.\n\nIt includes the ``pactl.py`` module, a Python implementation of the ``pactl``\ncommand that runs both on Pulseaudio and Pipewire. The output of most\n``pactl.py`` subcommands can be parsed by Python and when redirected to a file,\nthe file can be imported as a Python module. For example start an interactive\nPython session and inspect the ``cards`` object with all its nested sructures\nand dereferenced pointers with:\n\n.. code-block:: shell\n\n $ ./pactl.py list cards > cards.py && python -i cards.py\n\nCalling an async function is simple:\n\n.. code-block:: python\n\n import asyncio\n from libpulse.libpulse import LibPulse\n\n async def main():\n async with LibPulse('my libpulse') as lib_pulse:\n sink = await lib_pulse.pa_context_get_sink_info_by_index(0)\n print('sample_spec rate:', sink.sample_spec.rate)\n print('proplist names:', list(sink.proplist.keys()))\n\n asyncio.run(main())\n\nAnother example processing sink-input events:\n\n.. code-block:: python\n\n import asyncio\n from libpulse.libpulse import LibPulse, PA_SUBSCRIPTION_MASK_SINK_INPUT\n\n async def main():\n async with LibPulse('my libpulse') as lib_pulse:\n await lib_pulse.pa_context_subscribe(\n PA_SUBSCRIPTION_MASK_SINK_INPUT)\n iterator = lib_pulse.get_events_iterator()\n async for event in iterator:\n # 'event' is an instance of PulseEvent.\n some_function_to_process_the_event(event)\n\n asyncio.run(main())\n\nSee the libpulse `documentation`_.\n\nRequirements\n============\n\nPython version 3.8 or more recent.\n\nInstallation\n============\n\nInstall ``libpulse`` with pip::\n\n $ python -m pip install libpulse\n\n.. _libpulse: https://gitlab.com/xdegaye/libpulse\n.. _asyncio: https://docs.python.org/3/library/asyncio.html\n.. _ctypes: https://docs.python.org/3/library/ctypes.html\n.. _documentation: https://libpulse.readthedocs.io/en/stable/\n",
"bugtrack_url": null,
"license": null,
"summary": "Asyncio interface to the Pulseaudio and Pipewire pulse library.",
"version": "0.5",
"project_urls": {
"Changelog": "https://libpulse.readthedocs.io/en/stable/history.html",
"Documentation": "https://libpulse.readthedocs.io/en/stable/",
"Source": "https://gitlab.com/xdegaye/libpulse"
},
"split_keywords": [
"pulseaudio",
" pipewire",
" asyncio",
" ctypes"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "b6683631a18bf40bdc266a45d2b2a871a7fb23246f28f92e862ffc309bdfb29e",
"md5": "f9ce9c6a6c99b309311925ed4d495127",
"sha256": "61fa4c7d64fb798df5db572ed28039801d5f59e347b309ec99c1e1e8bbf87657"
},
"downloads": -1,
"filename": "libpulse-0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f9ce9c6a6c99b309311925ed4d495127",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4,>=3.8",
"size": 43585,
"upload_time": "2024-11-03T07:04:41",
"upload_time_iso_8601": "2024-11-03T07:04:41.826131Z",
"url": "https://files.pythonhosted.org/packages/b6/68/3631a18bf40bdc266a45d2b2a871a7fb23246f28f92e862ffc309bdfb29e/libpulse-0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "24ee41fab371e89b5ffff5dcc9aa1f24d18b70b2a8f478048c47eb358ebfcab2",
"md5": "0c28e48667b15f1a856934035287cbf8",
"sha256": "7d5a511473eb9738da828f5f39108878cbfce675d44bfd5cb1c10c2a90d45f41"
},
"downloads": -1,
"filename": "libpulse-0.5.tar.gz",
"has_sig": false,
"md5_digest": "0c28e48667b15f1a856934035287cbf8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4,>=3.8",
"size": 53496,
"upload_time": "2024-11-03T07:04:44",
"upload_time_iso_8601": "2024-11-03T07:04:44.041379Z",
"url": "https://files.pythonhosted.org/packages/24/ee/41fab371e89b5ffff5dcc9aa1f24d18b70b2a8f478048c47eb358ebfcab2/libpulse-0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-03 07:04:44",
"github": false,
"gitlab": true,
"bitbucket": false,
"codeberg": false,
"gitlab_user": "xdegaye",
"gitlab_project": "libpulse",
"lcname": "libpulse"
}