Snapcast

Snapcast (Synchronous audio player) plays audio streams time sychronized on multiple devices over network using a server and a client component. The server picks up an audio stream from a fifo pipe, thus it can be combined with any audio source that is able to write to a pipe. The Snapserver is able to handle multiple streams at once. The assignment of clients to streams and their volume is controlled via a JSON-API.

Server
The Snapserver should run as its own user:group e.g. snapserver:snapserver (default created during emerge).

A sample config that makes snapserver pick up an audio stream from the named pipe /tmp/snapfifo looks like this:

To start snapserver now run:

To start snapserver at boot time run:

For all snapserver options please see man snapserver

Client
The basic configuration for the client looks like this

This will run snapclient as daemon using the default soundcard. It will try to find servers on the network using Avahi, if installed and running.

To start snapclient now run

To start snapclient at boot time run:

Desktop environment/Selecting Soundcard
To make use of PulseAudio/use Snapclient in your desktop einvironment (to be able to use Snapclient alongside with other audio sources, control its volume, etc.) you would start it as your desktop user instead of letting the init system control it.

To get a list of soundcards, and select the right one, run

To use PulseAudio for example, use '1' with the -s command line option

Snapclient should now appear in your list of audio playing applications of PulseAudio.

Audio source
To make some testing noise, random bytes can be shoved into the snapservers pipe

Snapcast can basically be used with anything that is able to write PCM audio to a fifo.

MPlayer example
To make mplayer play something over snapcast use

MPD Example
To hear music with MPD over snapcast create a new audio_output in the mpd.conf using the fifo module

The samplerate setting is the default one used by snapcast. Different samplerates can be used but must be set in the snapserver config file first.

External resources

 * Snapcast Project page and sources: https://github.com/badaix/snapcast