Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

PipeWire audio output plugin

This plugin is what gets OxiGuitar’s sound out of your speakers or headphones on Linux. It hands the finished sound to PipeWire, the sound server of current Linux desktops (GNOME and KDE use it by default).

It uploads nothing and downloads nothing. It only plays sound on your computer.

It has the lowest delay of the Linux outputs. Where PipeWire isn’t running, install the ALSA output plugin as well, so OxiGuitar has something to fall back on.

What an audio output does

OxiGuitar works out the sound of a song as a stream of numbers, about 48,000 of them a second for each speaker. Something has to hand those numbers to the sound card, in small batches, always on time: if a batch is late, you hear a click or a gap. That is the job of the operating system’s sound system, and of this plugin, which connects OxiGuitar to it.

Two words come up when people talk about this:

  • Latency is the delay between OxiGuitar sending sound and you hearing it. For playing back a song it hardly matters, because the cursor is moved to match what you hear; it matters for anything you play along live.
  • The buffer is how much sound is handed over at a time. A bigger buffer is safer against clicks on a busy computer, at the cost of more latency.

Every operating system has its own sound system, and each needs its own code. OxiGuitar keeps each in a plugin of its own, so you install only the one your system uses.

How to use it shows where to pick the device.

How to use it

There is nothing to set up: install it, and OxiGuitar plays through it. The Output list in the player, at the top of the window, picks the device when you have more than one; System default follows whatever your system is set to:

Tools → Plugins… shows whether the plugin was found and loaded.

What you can do with it

  • Hear a score. OxiGuitar makes the sound, and this plugin hands it to the system.
  • Pick the output device, if you have more than one. The player’s Output list shows the devices this plugin offers.

A score plays through the sound plugin you have installed. See the OxiGuitar manual if you have no such plugin yet. Without an audio output plugin the player buttons stay greyed out, and OxiGuitar says so when it starts.

Architecture and strategy

The plugin gives OxiGuitar a list of devices and an audio stream. It is built on the cpal audio library, through a small layer that the other output plugins share, and it uses the PipeWire host of that library.

The strategy is one output plugin for each system’s own sound API, so each can be installed, updated and left out on its own. OxiGuitar picks among the installed outputs.

Current limitations

  • Needs glibc 2.39 or newer (Debian 13, Ubuntu 24.04, Fedora 40 and later), because PipeWire’s headers don’t build on older systems. The AppImage plays through ALSA instead.
  • No JACK-style routing from OxiGuitar. It plays to a device; patching it elsewhere is done with PipeWire’s own tools.
  • Your system’s sound must already work. The plugin doesn’t repair or configure PipeWire.

Left out on purpose

  • A sound library of our own. cpal, the Rust audio library, already speaks every system’s sound API. All four output plugins share a thin layer over it, oxiguitar-audio-cpal.
  • One plugin for every system. Each system’s output is a plugin of its own, so each is built, tested, updated and left out on its own, and a Linux install carries no Windows code.
  • Recording. The output plugins only play. OxiGuitar has no audio input.

Where you can help

  • Testing on real hardware, especially unusual sound cards, USB interfaces and Bluetooth headphones. Tell us what worked and what clicked.
  • Lower latency settings, if you know PipeWire well.

Every change needs its tests and a row on the Features page; the Testing page says how to run them.

Requirements and assumptions

Requirements

  • OxiGuitar 0.25 or later (the plugin asks for interface 3.0). See the OxiGuitar manual.
  • Linux, on x86_64 or ARM64, with libpipewire-0.3, which every PipeWire desktop has.
  • glibc 2.39 or newer, since the plugin is built on Ubuntu 24.04. PipeWire’s headers don’t build on Ubuntu 22.04. The AppImage, which is built on 22.04, plays through ALSA instead.

Assumptions

  • Your system’s sound is working already. This plugin doesn’t repair it.
  • PipeWire is what your desktop uses. If it isn’t, use the ALSA plugin.

Installing

You need OxiGuitar first: its manual says how to get it. This page is about the PipeWire audio output plugin.

From a release

Each release on the releases page has a zip for each Linux processor (x86_64 and ARM64), a .deb, an .rpm and a Flatpak for each, and a SHA256SUMS file to check the downloads against. Take the file that matches your system.

Copying the file yourself

A plugin is a single file ending in .oxp. Unzip the release for your system and put audio-pipewire.oxp in your plugins folder:

SystemYour plugins folder
Linux~/.local/share/oxiguitar/plugins/

Start OxiGuitar again. Tools → Plugins… lists what it found. The same menu switches a plugin off, and deleting the file removes it.

Linux package managers

The package is called oxiguitar-pipewire. It lives in a signed package repository on GitHub Pages that you add once.

Debian, Ubuntu and relatives:

sudo install -d -m 0755 /etc/apt/keyrings
sudo curl -fsSL https://mateusrdp.github.io/oxiguitar-packages/oxiguitar.gpg -o /etc/apt/keyrings/oxiguitar.gpg
sudo curl -fsSL https://mateusrdp.github.io/oxiguitar-packages/oxiguitar.sources -o /etc/apt/sources.list.d/oxiguitar.sources
sudo apt update
sudo apt install oxiguitar-pipewire

Fedora and relatives:

sudo curl -fsSL https://mateusrdp.github.io/oxiguitar-packages/oxiguitar.repo -o /etc/yum.repos.d/oxiguitar.repo
sudo dnf install oxiguitar-pipewire

Normal system updates keep the plugin current from then on.

OxiGuitar’s Flatpak is a sandbox that cannot see the system’s plugin folders, so it needs the plugin as a Flatpak extension. Flathub comes first because Flatpak takes its runtime from there:

flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
flatpak remote-add --if-not-exists oxiguitar https://mateusrdp.github.io/oxiguitar-packages/flatpak/oxiguitar.flatpakrepo
flatpak install oxiguitar io.github.mateusrdp.OxiGuitar.Plugin.pipewire

flatpak update keeps it current and flatpak remove takes it away.

Features and their tests

Everything this plugin does, and the tests that check it. The test names are the ones cargo test prints; a name after linux: is a test that only runs on PipeWire’s system. scripts/test-all.py fails when a feature here names no test, or names a test that doesn’t exist, so a new feature gets its row and its tests in the same pull request (the Testing page says how to run them).

The plugin is a thin layer: opening, feeding and closing the output stream is OxiGuitar’s own oxiguitar-audio-cpal code (through cpal), which this plugin uses as released. Hearing the sound needs a sound card, so the tests check everything up to it.

FeatureWhat it doesTests
The PipeWire outputOffers the audio-device service pipewire, and nothing else, so the player can send its sound to PipeWire.tests::it_offers_only_the_pipewire_audio_device, linux:contract::the_plugin_file_keeps_the_contract
Says when it can’t playProbing tells the player whether there’s an output, and why not when there isn’t (shown in the footer and Tools > Plugins).linux:tests::probing_says_whether_there_is_an_output
Picks the output deviceLists the system’s output devices by name for the footer’s output chooser.linux:tests::listing_the_outputs_answers_with_or_without_a_device
Refuses wrong requestsA damaged request to open an output, or a method it doesn’t have, gets an error, never a crash.linux:tests::wrong_requests_are_refused
Only on PipeWire’s systemIts manifest limits it to linux; anywhere else it is never available and says why.oxiguitar_plugin_checks::the_manifest_matches_the_plugin, windows,macos:tests::elsewhere_it_says_it_runs_only_on_linux
A working plugin fileThe .oxp file keeps the plugin contract, with this repository’s SDK version and with the newest release of OxiGuitar.linux:contract::the_plugin_file_keeps_the_contract, stage:contract (latest core)

Testing

Every test of this repository runs with one command, on your own machine, and anyone can run it. When something fails, it tells you how to report it.

Run everything

python3 scripts/test-all.py

On Windows, type python instead of python3 if that’s what you have.

You need:

  • Rust, from rustup (the version in Cargo.toml’s rust-version or newer);
  • git, and Python 3.8 or newer (nothing to install with pip);
  • on Linux, the libraries a build needs: libasound2-dev, libpipewire-0.3-dev and libclang-dev on Debian and Ubuntu (alsa-lib-devel, pipewire-devel and clang-devel on Fedora);

It runs:

  1. every Rust test of the repository (cargo test over the whole workspace), with a progress bar;
  2. the plugin against the newest release of OxiGuitar: it fetches that release’s source with git (once per release, kept in a cache folder every OxiGuitar repository on your machine shares: ~/.cache/oxiguitar-test-all, ~/Library/Caches/oxiguitar-test-all on macOS, %LOCALAPPDATA%\oxiguitar-test-all on Windows, or OXIGUITAR_TEST_CACHE), builds its oxiguitar-cli and oxiguitar-plugin-test, builds this repository’s plugin file for your system and runs the plugin contract on it;
  3. a check of the Features page: every feature names a test, and every test it names exists.

It tests the system and processor it runs on, and only those (as Rust sees them: rustc -vV’s host). Tests for other systems are left out and the summary says so; they are not failures.

This repository is for linux only: elsewhere the script says there’s nothing to test and stops.

What you get

A line per stage while it runs, then the result. In target/test-all/<date>-<time>/:

  • summary.md: the result, your system, what failed and why, short enough to paste into a GitHub issue;
  • test-all.log: everything that happened, every command and its output;

The script exits with 0 when everything passed, 1 when something failed, and 2 when it couldn’t start.

When something fails

  1. Update to the newest develop (git checkout develop && git pull) and run it again: it may be fixed already.
  2. Look for an issue about the same test at github.com/mateusrdp/oxiguitar-pipewire/issues.
  3. Otherwise open one: call it test-all: <the first failing test>, paste the whole summary.md, and attach test-all.log (drag it onto the text box; zip it first if it’s over 25 MB). Read the log first: it has your folder names, so change anything you’d rather keep private.
  4. You can also give summary.md and test-all.log to a language model along with this repository and ask it to find the cause.

Options

  • --release: an optimised test build: slower to build, faster corpus tests.
  • --ignore-rust-version: for a Rust older than rust-version (unsupported, but handy).
  • --core DIR: test against a checkout of OxiGuitar you already have, instead of its newest release; --core-version v0.21.5 picks a release.
  • --out DIR: where the results go.

Adding a feature

A new feature comes with its tests and a row on the Features page, in the same pull request; a new corpus test uses tests/support/corpus.rs. The script fails until the row names tests that exist.

Credits

Thank you to the people whose work this plugin is built on.

Code we use

ProjectAuthorsWhat it does hereLicence
OxiGuitar’s plugin SDK (oxiguitar-plugin, and oxiguitar-plugin-test for the tests)Mateus Rocha de Paula and the OxiGuitar contributorsThe plugin interfaceMIT OR Apache-2.0
oxiguitar-audio-cpalMateus Rocha de Paula and the OxiGuitar contributorsThe layer all four output plugins shareGPL-3.0-or-later
cpalThe RustAudio contributorsDevices and the audio stream, on every systemApache-2.0
pipewire-rsThe PipeWire contributorsTalks to PipeWire (pipewire, libspa)MIT
Rust and its standard libraryThe Rust ProjectEverything elseMIT OR Apache-2.0

The system

PipeWire, by Wim Taymans and the PipeWire contributors: the sound server itself, on your computer. The plugin only calls it.

Tools

ToolUse
mdBookBuilds this manual
cargo-denyChecks the licences of everything we build with

Thanks

To the RustAudio community for cpal, which turns four very different sound systems into one, and to the people behind PipeWire.