Desktop companion
The AudioX companion runs on your desktop and connects to the Pi over its USB network. When connected, the WebUI shows a Desktop page with the host name, operating system, and detected capabilities. The page disappears on disconnect. Only one companion can be connected at a time.
This is an early version: media controls and shortcuts are not implemented yet. On Linux, the Desktop page supports default playback device selection and automatic playback and capture routing without scripts. pipewire indicates a detected PipeWire socket. default_sink requires a PipeWire socket and either pactl, or both wpctl and pw-dump, on the companion's PATH. The companion uses WirePlumber if pactl cannot read the default; pw-dump is also required for the device dropdowns. Default-device control is not available on Windows or macOS. Select a discovered playback device under Default playback device. The displayed default is sampled approximately once a second, so very brief changes can be missed. Detection does not guarantee that the host audio service accepts a command. The route_stream capability requires pactl on the companion's PATH, and auto_route also requires pw-dump, pw-loopback, and pw-metadata. On Linux, if playerctl is on PATH, the page also reports the aggregate MPRIS playback status. Any playing player takes precedence over paused or stopped players. No players and query errors are shown separately. Lua scripts can read the status with desktop.media_status() and desktop.is_playing().
If a script reports that the desktop default sink is unavailable, check that the Desktop page shows the connected host and default_sink capability. The companion log explains missing tools, a missing PipeWire socket, or a failed default query, and reports whether the Pi requested default tracking; for the user service, inspect journalctl --user -u audiox-companion.service -b. A command permission error may have several causes, including SELinux; inspect the host's denial logs before changing security settings. A companion started outside systemd writes the same diagnostics to its standard error.
For a manual end-to-end test, download desktop-default-toggle.lua, add it as a script with device-management permission, and select a desktop playback device. The Toggle desktop default button requests the selected device; press it again to restore the previous default. Check the script and companion logs for errors. The remembered device is runtime-only and is discarded when a different desktop session connects. If another application changes the default in between, the next press remembers that new default instead of restoring an old one.
When pw-dump is available on Linux, the Desktop page also lists PipeWire nodes, including active application streams. The dropdowns refresh automatically and can be refreshed manually.
Connecting
The companion connects to 172.31.73.1:80 by default, without storing settings on the host. It retries automatically if the USB link or Pi disappears. With a KVM, the newly connected desktop keeps retrying until the previous connection has closed or timed out. Capability detections are refreshed every five seconds; the companion sends another hello only when the results change.
To try a different IPv4 address or port without saving settings, run the executable with --host <IPv4-address> --port <port>. The Pi's HTTP service normally listens only on its USB network address.
Automatic Linux app routing
Start playback or capture in the application, open Desktop, and select the direction, application, destination, and stereo pair. Select Add rule. For a four-channel USB device, channels 3/4 select its second stereo pair. The application must have an active audio stream when you create the rule; afterwards the companion reapplies it when matching streams appear.
With Enable AudioX virtual stereo channels on (the default), each stereo pair on an AudioX USB device is also exposed as a separate desktop device, such as AudioX Channel 1 and AudioX Channel 2. Select these directly in applications or in EasyEffects. The setting is stored on the Pi. Virtual devices exist while the companion is connected; disabling them or disconnecting the companion removes them, and applications may fall back to another device.
Rules are stored on the Pi and included in configuration backups. They apply to any connected Linux desktop with matching names. The first matching rule wins. Exact names are case-sensitive; the optional advanced patterns are POSIX extended regular expressions and match substrings. A destination pattern must match exactly one device. At most 16 rules and 32 active automatic moves are supported. A destination must expose an even channel map; unavailable devices, invalid pairs, and routing failures are reported in the page and companion logs.
The companion uses PipeWire loopbacks for AudioX stereo pairs and PulseAudio remap modules for other destinations. The Linux AppImage automatically installs the WirePlumber 0.5 routing policy to apply AudioX app rules before initial linking; it also protects internal remap streams from being redirected by other applications. Installation or upgrades restart the active WirePlumber user service and briefly interrupt audio. See the companion README. It attempts to restore streams when a rule is removed or the connection closes, without overwriting a stream that was moved elsewhere. Restoration is best-effort and cannot be guaranteed after a crash, audio-server restart, or device removal. Manual Lua moves cannot override streams currently managed by an automatic rule.
Forwarding a device to desktop speakers
A Forward device rule plays one stereo pair of a desktop capture device on a desktop playback device. Use it for speakers that are connected to the desktop instead of the Pi, such as HDMI speakers. While the companion is connected, it keeps a PipeWire loopback (AudioX forward) running from the selected pair to the selected device. It restarts the loopback if it exits. The option appears only when the companion reports the forward capability, which requires an updated companion and the same tools as automatic routing. Older companions ignore forward rules.
To toggle a MIDI button between headphones on the Pi and desktop speakers:
- Enable a four-channel USB gadget so the desktop sees AudioX capture channels 3/4.
- On Routing, send your source through a Cut to the headphones output, and through a second Cut to USB-to-host channels 3/4.
- On Desktop, choose Forward device, the AudioX capture device, Channels 3/4, and the speakers, then select Add rule.
- Download output-toggle.lua, add it as a script, set the two Cut effect IDs, and bind it to a MIDI note or CC button.
Each press mutes one Cut and unmutes the other. The forward loopback stays on, so the speakers receive silence while the headphones are selected.
Lua stream routing
For custom automation, scripts can use the same IDs with desktop.route(stream_id, sink_id). For example, replace the numbers below with current IDs and enable device-management permission when saving:
hook("run", function()
desktop.route(11, 2)
end)The script queues the move asynchronously; check device logs for failures. For a read-only test of the media connection, run this script and inspect the device logs:
hook("run", function()
log("Desktop media: " .. desktop.media_status())
end)Linux installation and tray
Running the release AppImage installs a user-local copy, launcher, and systemd user unit. On first launch, choose whether to enable the unit at login in the browser page; it is not enabled automatically. The launcher uses AppImage extraction, so a FUSE mount is not required.
Right-click the AudioX tray icon to open the Pi, configure login startup, or update the desktop and connected Pi together. The update page lets you select stable or nightly and confirm the Pi reboot; it verifies both downloads before uploading firmware. See the companion README. Use systemctl --user status audiox-companion.service and journalctl --user -u audiox-companion.service to inspect its status and logs.
Windows and macOS companion support is deferred until after 2.0.
Security
The companion uses the separate audiox.desktop.v1 WebSocket protocol. Like the WebUI, it does not authenticate native peers: use only on a trusted USB network and do not expose it to the internet. See the API reference for the hello and status-event formats.