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.
How it works
Section titled “How it works”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.
Events
Section titled “Events”| Event | Description |
|---|---|
start | Application startup |
stop | Application shutdown |
connect | Device connected (CD, USB, Bluetooth, etc.) |
disconnect | Device disconnected |
error | Error notification |
Sound format
Section titled “Sound format”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.
Integration
Section titled “Integration”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:
# Play a soundodio-notify play startodio-notify play connect disconnect
# List available eventsodio-notify list
# Custom sounds directoryodio-notify --sounds-dir /path/to/custom play error
# Remote PulseAudio serverodio-notify --pulse-server tcp:192.168.1.10 play startPre-built binaries (amd64, arm64, armv7, armv6) are available on each release.