A low-latency, real-time audio engine built on PipeWire, designed for virtual audio routing and DSP processing.
This engine is used by OpenLinkHub to provide headset audio control, EQ, and output routing with minimal latency.
The core audio engine is implemented in C, with a Go control plane exposed via a simple HTTP API.
- Virtual PipeWire sink name:
openlinkhub-virtual-device - Developed as part of OpenLinkHub, but the audio engine is self-contained and reusable.
- See
main.gofor examples oraudio.hfor API access.
This project depends on PipeWire development headers and uses pkg-config via CGO.
- PipeWire (0.3)
pkg-config- PipeWire development headers
sudo dnf install pipewire-devel pkg-configfor RPM based distrossudo apt install libpipewire-0.3-dev pkg-configfor DEB based distros
$ go run .
API running on 127.0.0.1:7777
- GET /sinks -> list sinks (JSON)
- POST /sink?serial=XXXX -> select sink
- POST /band?i=5&db=12 -> EQ band
- POST /master?db=-6 -> master gain
- POST /stop -> stops the engine
- POST /current-sink -> get current sink (JSON)
[DEBUG 24486.006] Physical sink: CORSAIR VIRTUOSO MAX WIRELESS Gaming Receiver Analog Stereo (alsa_output.usb-Corsair_CORSAIR_VIRTUOSO_MAX_WIRELESS_Gaming_Receiver_A9SVC43300IDO4-00.analog-stereo)
[DEBUG 24486.006] connect_capture_latency: 128/48000
[DEBUG 24486.006] connect_capture_latency_max: 256/48000
[DEBUG 24486.006] capture : unconnected -> connecting
[DEBUG 24486.006] connect_playback_latency: 128/48000
[DEBUG 24486.006] connect_playback_latency_max: 256/48000
[DEBUG 24486.006] playback: unconnected -> connecting
[DEBUG 24486.006] playback connected to target serial=71
[DEBUG 24486.006] Running.
[DEBUG 24486.006] Virtual sink: openlinkhub-virtual-device (OpenLinkHub Virtual Audio Device)
[DEBUG 24486.006] Playback node: openlinkhub-virtual-device-playback (role=Music, category=Playback)
[DEBUG 24486.006] Ring buffer: 512 frames (0.01s)
[DEBUG 24486.006] capture : connecting -> paused
[DEBUG 24486.006] playback: connecting -> paused
[DEBUG 24486.019] playback: paused -> streaming
API server:
127.0.0.1:7777
GET /sinksReturns a JSON list of available PipeWire sinks (excluding the engine’s own virtual sink).
Example:
[
{
"index": 0,
"serial": 69,
"name": "alsa_output.usb-...",
"desc": "Corsair Headset Analog Stereo"
}
]POST /sink?serial=XXXXRoutes audio output to the sink identified by its serial number.
POST /band?i=5&db=12i— band index (1–10)db— gain in decibels
POST /master?db=-6Sets the global output gain in decibels.
POST /current-sinkReturns the currently selected sink as JSON.
POST /stopGracefully stops the audio engine.