Skip to content

Instantly share code, notes, and snippets.

@ljfranklin
Created April 10, 2020 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ljfranklin/9ba9f2d7705e1b1f38389937d25f54e0 to your computer and use it in GitHub Desktop.
Save ljfranklin/9ba9f2d7705e1b1f38389937d25f54e0 to your computer and use it in GitHub Desktop.
Setup snapcast

Install snapserver/snapclient.

Create /etc/systemd/system/snapfifo.service with contents:

[Unit]
Description=Pipes line-in to /tmp/snapfifo pipe
After=snapserver.service

[Service]
Type=simple
Restart=always
# restart every hour, having stability issues (TODO try removing this)
RuntimeMaxSec=3600
# give snapserver time to create /tmp/snapfifo pipe
ExecStartPre=/bin/bash -c 'while true; do if [ -e /tmp/snapfifo ]; then break; fi; sleep 1; done'
ExecStart=/usr/bin/arecord -c 2 -D hw:CARD=CODEC,DEV=0 -f S16_LE -r 48000 /tmp/snapfifo

[Install]
WantedBy=multi-user.target

Run at boot:

sudo systemctl enable snapfifo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment