Skip to content

Audio Notifications

go-odio-notify is a pure Go audio notification library that plays short event sounds through PulseAudio. No CGO dependency — it uses jfreymuth/pulse directly.

It provides audio feedback for system events: disc insertion, device connection, errors, and more. The only requirement is a running PulseAudio (or PipeWire with pipewire-pulse) server.

Sounds are played as PulseAudio event streams (media.role=event), so they don’t interfere with music playback and follow system event volume rules. The connection to PulseAudio is lazy — the library starts without blocking even if PulseAudio isn’t ready yet, and reconnects automatically.

EventDescription
startApplication startup
stopApplication shutdown
connectDevice connected (CD, USB, Bluetooth, etc.)
disconnectDevice disconnected
errorError notification

PCM raw, signed 16-bit LE, stereo, 44100 Hz. Target duration: 0.5–1.5s.

Default sounds are embedded in the binary. You can override them by placing custom .pcm files in a directory and pointing SoundsDir to it.

go-odio-notify is used as a library by go-mpd-discplayer and go-odio-api to provide audio feedback for disc/USB events and API state changes.

A standalone CLI is available for testing and scripting:

Terminal window
# Play a sound
odio-notify play start
odio-notify play connect disconnect
# List available events
odio-notify list
# Custom sounds directory
odio-notify --sounds-dir /path/to/custom play error
# Remote PulseAudio server
odio-notify --pulse-server tcp:192.168.1.10 play start

Pre-built binaries (amd64, arm64, armv7, armv6) are available on each release.