A simple CLI script to setup PulseAudio loopbacks
Project description
pulseaudio-simple-loopback
A simple Python CLI tool for quickly setting up and tearing down PulseAudio loopback modules — ideal for routing audio between input and output devices like USB interfaces, Bluetooth headsets, and virtual sinks.
Developed because I coudn't be bothered to set it up manually every time I wanted to play on my Korg synthesizer ʅ ( ․ ⤙ ․) ʃ.
It provides two terminal commands:
loopback-setup: Interactively sets up PulseAudio loopback between a selected input and output.loopback-stop: Unloads all loaded loopback modules.
Installation
Option 1: Install from PyPI (Recommended)
pip install pulseaudio-simple-loopback
Installs the loopback-setup and loopback-stop commands system-wide.
Option 2: Install from source
git clone https://github.com/YOUR_USERNAME/pulseaudio-simple-loopback.git
cd pulseaudio-simple-loopback
pip install .
Usage Example
loopback-setup
This command walks you through selecting a source and sink from your available PulseAudio devices, and then creates a loopback between them.
❯ loopback-setup
Available Sources
┏━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Index ┃ Name ┃
┡━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ 0 │ alsa_input.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.analog-stereo-input │
│ 1 │ bluez_input.14:3F:A6:F2:83:9D │
└───────┴──────────────────────────────────────────────────────────────────────────┘
Select audio source index: 0
Available Sinks
┏━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Index ┃ Name ┃
┡━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ 0 │ alsa_output.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.analog-stereo-output │
│ 1 │ bluez_output.14_3F_A6_F2_83_9D.1 │
└───────┴────────────────────────────────────────────────────────────────────────────┘
Select audio sink index: 1
Setting loopback from: alsa_input.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.analog-stereo-input to bluez_output.14_3F_A6_F2_83_9D.1
Loopback module ID: 536870918
Loopback enabled successfully
In some cases with Bluetooth output devices (for ex. Sony WH-1000XM4), PulseAudio may not activate the loopback immediately.
Hence, when a Bluetooth sink is selected, the script offers to quickly disconnect and reconnect the device — which usually helps:
Detected Bluetooth sink: bluez_output.14_3F_A6_F2_83_9D.1, MAC: 14:3F:A6:F2:83:9D
The script detected you've selected a Bluetooth device as the loopback sink.
In some instances, the device needs to be disconnected and reconnected if the loopback doesn't start properly.
Do you want to disconnect and reconnect your Bluetooth device now? [y/n]:
loopback-stop
This command unloads all detected loopback modules:
❯ loopback-stop
Unloading module-loopback ID 536870918...
Unloaded 1 loopback module(s)
License
MIT License. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pulseaudio_simple_loopback-1.0.0.tar.gz.
File metadata
- Download URL: pulseaudio_simple_loopback-1.0.0.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b136b3d19a6911dde0b037ac638e0c5aaab0940726b0cf63a3ea92e49d5a75c9
|
|
| MD5 |
8b5704c50f4af1454ff2a62eec196667
|
|
| BLAKE2b-256 |
6ab97173ded30a8b48e474230ca48e978684d8d4bee1212257665886544b3868
|
File details
Details for the file pulseaudio_simple_loopback-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pulseaudio_simple_loopback-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18ffc4d29c9f82c00a4b08284b378cbc056b98dea3d5a748f02d64747675bc06
|
|
| MD5 |
f7641255807642e2ec2cb5e06f2b0848
|
|
| BLAKE2b-256 |
0de531a87dec28328d77fe25cc040500eff15a4ba74f2e5b282dc523e8722cf6
|