Skip to main content

PIPEWIRE's Python controller (wrapper)

PyPI Version Build Status publish_docs publish_pypi PyPI Supported Python Versions codecov Maintainability Test Coverage Downloads

JOIN OUR TELEGRAM SUPPORT:

Telegram

  • ONLY AUDIO BY NOW [PR & FR WELCOME]
  • STREAMING NOT SUPPORTED BY NOW

Python controller, player and recorder via pipewire's commands.

  • Pipewire is a project that aims to greatly improve handling of audio and video under Linux. (Better than pulseaudio or jack)

Requirements

  1. A Pipewire version installed (clean or via Pulseaudio) is needed, to check if you have pipewire installed and running, run this command, if the output is different, you'll need to install pipewire:

    1. Pipewire versions supported: 0.3.30, 0.3.32+
pw-cli info 0
# Example output
    id: 0
    permissions: rwxm
    type: PipeWire:Interface:Core/3
    cookie: 134115873
    user-name: "user"
    host-name: "user"
    version: "0.3.30" # Possibly more actual than this version
    name: "pipewire-0"
...

To uninstall pipewire click here.

  1. Python 3.7+
  2. Ubuntu 20.04+

Install & Tutorial

Install

pip3 install pipewire_python # or pip

Tutorial

PLAY AND RECORD

from pipewire_python.controller import Controller

# [PLAYBACK]: normal way
audio_controller = Controller()
audio_controller.set_config(rate=384000,
                            channels=2,
                            _format='f64',
                            volume=0.98,
                            quality=4)
audio_controller.playback(audio_filename='docs/beers.wav')

# [RECORD]: normal way
audio_controller = Controller()
audio_controller.record(audio_filename='docs/5sec_record.wav',
                        timeout_seconds=5)

GET INTERFACES

from pipewire_python.controller import Controller

audio_controller = Controller()
# Return all Client Interfaces on Pipewire
audio_controller.get_list_interfaces(
    type_interfaces="Client",
    filtered_by_type=True,
)
# Return all interfaces
audio_controller.get_list_interfaces(
    filtered_by_type=False,
)

LINK PORTS

Linking Ports

from pipewire_python import link

inputs = link.list_inputs()
outputs = link.list_outputs()

# Connect the last output to the last input -- during testing it was found that
# Midi channel is normally listed first, so this avoids that.
source = outputs[-1]
sink = inputs[-1]
source.connect(sink)

# Fun Fact! You can connect/disconnect in either order!
sink.disconnect(source) # Tada!

# Default Input/Output links will be made with left-left and right-right
# connections; in other words, a straight stereo connection.
# It's possible to manually cross the lines, however!
source.right.connect(sink.left)
source.left.connect(sink.right)

Documentation

You can check the automatic build documentation HERE

Roadmap

Future implementations, next steps, API implementation and Control over Pipewire directly from python in the ROADMAP.

Contributions

PR, FR, and issues are welcome. Changes with PR in dev branch please due documentation runs after each commit in main branch. Check more here

License

LICENSE

Release files for pipewire_python 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pipewire_python 0.2.3
File Size Uploaded
pipewire_python-0.2.3.tar.gz 1.3 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for pipewire_python 0.2.3
File Interpreter ABI Platform
pipewire_python-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 1.4 MB

Release files / pipewire_python-0.2.3.tar.gz

Download URL pipewire_python-0.2.3.tar.gz
Size 1.3 MB
Tags Source
SHA-256 checksum
How to use checksums
4add001b9aecfb40e4629b769d1a86b3fffa576406cab84214c9a04ec77ac955
BLAKE2b-256 checksum
How to use checksums
677feee00d9a89d8b2b8696ef2b6384619114bf3ebc1b44912ba17107a954e2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.28.2

Release files / pipewire_python-0.2.3-py3-none-any.whl

Download URL pipewire_python-0.2.3-py3-none-any.whl
Size 17.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f0f7458622d0d33082c08fea2bc1e4046577114c7da44dda420d003f58bc6ce5
BLAKE2b-256 checksum
How to use checksums
6d2ec86f4b19d455ee8710d81f991e51726251d0e7db2bb78849c8fbd68d9b37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.28.2

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 release files

0.2.1

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.96

2 release files

0.0.95

2 release files

0.0.92

2 release files

0.0.91

2 release files

0.0.90

2 release files

0.0.89

2 release files

0.0.86

2 release files

0.0.85

2 release files

0.0.83

2 release files

0.0.82

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page